Hi all,

How to find the free physical memory...
actually i want to avoid the exception from new operator..
i have used the GlobalMemoryStatus a windows api for this
but new is giving exception still more memory available than
i am allocating.

I am using visual studio 2005

Please help me....
Thanks in advance...

It is not entirely clear what problem you are having from your description.

I assume that this is not just a memory leak that has arisen in your code from calling new() without delete.

But from a problem I had recently with new() giving a bad memory alloc exception. I found that visual studio has ~2Gb limit as an application. There are both compiler and OS issues with trying to load very large amounts of memory at once. This also has limits when the memory is being reserved for dynamic memory as it was doubling each time. If you are not using more than 1Gb then I imagine that you have a different problem.

REading very briefly about globalmemorystatus on msdn you are probably going to get an over flow error and so you would need GlobalMemoryStatusEx

Hi all,

How to find the free physical memory...
actually i want to avoid the exception from new operator..
i have used the GlobalMemoryStatus a windows api for this
but new is giving exception still more memory available than
i am allocating.

I am using visual studio 2005

Please help me....
Thanks in advance...

I found that visual studio has ~2Gb limit as an application.

That is the limit of all 32-bit compilers, not just visual studio. Install a 64-bit compiler (vs express doesn't support it, so you will have to buy it) on a 64-bit os and the limit will be a lot larger. I think, but not sure, that g++ and gcc will compile 64-bit programs.

Edited 6 Years Ago by Ancient Dragon: n/a

This article has been dead for over six months. Start a new discussion instead.