CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

Garbage collector and memory used in the system

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   May 27, 2009, 09:17
Default Garbage collector and memory used in the system
  #1
Member
 
Virginie Ehrlacher
Join Date: Mar 2009
Posts: 52
Rep Power: 8
virginie_e is on a distinguished road
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
virginie_e is offline   Reply With Quote

Old   May 28, 2009, 11:19
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by virginie_e View Post
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
gschaider is offline   Reply With Quote

Old   May 28, 2009, 21:57
Default
  #3
Senior Member
 
Henrik Rusche
Join Date: Mar 2009
Location: Braunschweig, Niedersachsen, Germany
Posts: 275
Rep Power: 9
henrik is on a distinguished road
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
henrik is offline   Reply With Quote

Old   May 29, 2009, 08:00
Default
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by henrik View Post
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
gschaider is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



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