Click here to Skip to main content
15,943,477 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Everyone,

Could somebody explaine me why the task manager does not directly update the memory usage after a free() operation?

I have the following loop:

MeassCollection = CreasteMeasurementCollection(); // based on CPtrArray

for (i = 1; i <= 8; i++) {
Meas = CreateMeasObject();
Meas.size = 1024s // samples
// this uses internally a malloc (pfSamples = (float*) malloc(Meas.Size * sizeof(float)));

for (j = 1; i <= 250; i++) {
MeasCloned = CreateMeasObject(Meas); // create an empty meas and copy the samples
// this uses internally a malloc (pfSamples = (float*) malloc(Meas.Size * sizeof(float)));

Meas.submeasurements.add (MeasCloned);

}
MeassCollection.Add(Meas);
}

If I run this several time the memory usage in the task manager does not return to the intial application startup state ?
Is it normal if I do not see the update directly ? Is it like a cache system for later allocation purposes?

Could you please explain ?

Thank you very much in advance.
Best regards.
SuperMiQi
Posted

1 solution

This article may help you

Windows Memory Management[^]
 
Share this answer
 
Comments
SuperMiQi 11-Apr-12 13:42pm    
Hello Sir,

Thank you very much. I still would like to know what you could suggest me to see the real memory usage ? Do you know a good memory tool viewer to check the memory usage ?

Thank you very much in advance.
Best regards.
SuperMiQi
jk chan 12-Apr-12 0:48am    
check perfmon and add private bytes counter
SuperMiQi 18-Apr-12 4:18am    
Hello jk chan,

I think after several loop iterations the memory usage is stable, it does not release immediatly but when allocation is needed it does not increase the application memory. I think it keeps it (magically) for later purposes.
If you have an idea how this could happen, I would be happy to read it.

Thank you very much in advance
Best regards.
SuperMiQi.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900