Historically Apple never revealed the amount of RAM you can find in the iPhone. It’s not really clear why they keep this a secret but one can think Apple wants you to focus more on the general user experience than on the technical specifications of the iPhone.
Some people do like to know about the technical aspects of their gadgets though. The iPhone 2G and 3G had 128MB, while the iPhone 3GS and iPad have 256MB. This partly explains why Apple doesn’t offer all of the features of iOS 4 to the iPhone 2G and 3G: they simply can’t take it!
During one of the WWDC sessions last week, Apple confirmed that the iPhone 4 has 512MB of RAM. That is twice the amount of RAM of the iPhone 3GS and the iPad.
As MacRumors notes, the added RAM should help overall performance and multi-tasking on the new iPhone 4. It could also explain why the iMovie App that Apple introduced at WWDC will only run on the iPhone 4. Apple has said iMovie will only run on the iPhone 4 and not the 3GS or even the iPad.