Apple [AAPL] has confirmed that the iPhone 4 has 512MB of RAM inside. The original iPhone and iPhone 3G had 128MB while the iPhone 3GS and iPad have 256MB. Doubling the RAM in the iPhone 4 will allow developers more room to work with.
It is also believed to be the reason why iMovie for example, is an iPhone 4 only download. The 3GS and iPad simply do not have enough RAM to handle the HD video editing.
We had heard that Apple confirmed this 512MB figure during one of the WWDC sessions last week, and have now verified this. The session it was revealed in is now available (Session 147, Advanced Performance Optimization on iPhone OS, pt 2) for registered Apple developers.