CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Garbage collector and memory used in the system (http://www.cfd-online.com/Forums/openfoam-solving/64883-garbage-collector-memory-used-system.html)

virginie_e May 27, 2009 09:17

Garbage collector and memory used in the system
 
Hello Foamers,

I am sorry to ask such a stupid question but I did not find any thread on the subject. How can we call the garbage collector of C++ in OpenFOAM syntax and how can we see the size of the memory allocated during the simulation?
I tried the following command lines:

System.GC.Collect();
and
Console::WriteLine("memory allocated", Environment::WorkingSet);

but I got some error messages such as Console, Environment and System have not been declared. This may be just a question of C++ and of package to load. I beg your pardon for polluting the forum if it is the case but some help would be very much appreciated.
Thank you in advance

Virginie

gschaider May 28, 2009 11:19

Quote:

Originally Posted by virginie_e (Post 217320)
Hello Foamers,

I am sorry to ask such a stupid question but I did not find any thread on the subject. How can we call the garbage collector of C++ in OpenFOAM syntax and how can we see the size of the memory allocated during the simulation?
I tried the following command lines:

System.GC.Collect();
and
Console::WriteLine("memory allocated", Environment::WorkingSet);

but I got some error messages such as Console, Environment and System have not been declared. This may be just a question of C++ and of package to load. I beg your pardon for polluting the forum if it is the case but some help would be very much appreciated.
Thank you in advance

Virginie

There is no garbage collector in C++. Not unless you use a library that implements one. The programmer is responsible for freeing memory. To have something similar to garbage collection OF has the templates autoPtr and tmp

Bernhard

henrik May 28, 2009 21:57

Dear Vergine,

yes, no garbage collecion in C++.

If "top" is good enough, you can profile the memory comsumption using getrusage. Consult the man page for details.

Henrik

gschaider May 29, 2009 08:00

Quote:

Originally Posted by henrik (Post 217497)
If "top" is good enough, you can profile the memory comsumption using getrusage. Consult the man page for details.

Or you can use (beware: advertisment) the pyFoamRunner-Utilities. They have an option --report-usage which at the end of the run reports the maximum-memory consumption encountered. Only works for serial though and not on every system

Bernhard


All times are GMT -4. The time now is 11:07.