Given this paragraph about the demographics of Osaka, what was the highest number of residents ever recorded to be living in Osaka at any one point in time?

Context: Population numbers have been recorded in Osaka since as early as 1873, in the early Meiji era. According to the census in 2005, there were 2,628,811 residents in Osaka, an increase of 30,037 or 1.2% from 2000. There were 1,280,325 households with approximately 2.1 persons per household. The population density was 11,836 persons per km2. The Great Kantō earthquake caused a mass migration to Osaka between 1920 and 1930, and the city became Japan's largest city in 1930 with 2,453,573 people, outnumbering even Tokyo, which had a population of 2,070,913. The population peaked at 3,252,340 in 1940, and had a post-war peak of 3,156,222 in 1965, but continued to declined since, as the residents moved out to the suburbs.

There were 144,123 registered foreigners, the two largest groups being Korean and Chinese 2021 years. Ikuno, with its Tsuruhashi district, is the home to one of the largest population of Korean residents in Japan, with 20,397 registered Zainichi Koreans.

Answer: The highest population ever recorded in Osaka was 3,252,340 in 1940.