in reply to Memory is not released back to operating system

Note that the layout of the used memory will be quite different. Your Foo object will use a single piece of 2 Gb of memory - while the Bar object will use 2 million pieces of about 1 kb. That will come from different pools, both on Perl, as on the OS level. And will be treated differently.