Memory Build shown by task manager in Windows
-
Hi, Was just trying out a small sample code which allocates certain amount of memory(say 80 MB).Now the Task Manager shows certain amount of memory(xxxx). I generate 400000 random numbers and free of the memory in those locaitons. the random number funda is used to have a defragmented deallocation. Even after freeing almost half(40 MB) of memory the Task manager dosent seem to show the reduction. I guess, this is because of the defragmented deallocation which was done.Any suggetions or comments??? srikanth sundaragopalan
-
Hi, Was just trying out a small sample code which allocates certain amount of memory(say 80 MB).Now the Task Manager shows certain amount of memory(xxxx). I generate 400000 random numbers and free of the memory in those locaitons. the random number funda is used to have a defragmented deallocation. Even after freeing almost half(40 MB) of memory the Task manager dosent seem to show the reduction. I guess, this is because of the defragmented deallocation which was done.Any suggetions or comments??? srikanth sundaragopalan
This is probably in the workings of the (MSVC I presume) CRT memory manager. Have a look at the malloc/free (and its implementation functions) sources and you'll see likely causes. Basically, it doesn't give up memory to the OS right away. Disclaimer: This depends on the OS and version of the MS CRT! MSVC6+ using NT5+ uses the plain HeapAlloc API's where older versions do not, and IIRC it's only for allocations above/below a certain threshold.