CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Main CFD Forum

Memory release

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

Reply
 
LinkBack Thread Tools Display Modes
Old   January 27, 2006, 11:23
Default Memory release
  #1
m. malik
Guest
 
Posts: n/a
Re: A FORTRAN 90/95 or C/C++ code While taking a conditional termination from the running of a code, should one deallocate (delete) all the memory that has been allocated upto that point? How important is it? Will appreciate your comments/thoughts.
  Reply With Quote

Old   January 27, 2006, 12:01
Default Re: Memory release
  #2
ag
Guest
 
Posts: n/a
In theory termination of the code will free up the memory. In practice it is good programming etiquette to deallocate what has been allocated when you are done with it. My experience has been primarily with FORTRAN.
  Reply With Quote

Old   January 27, 2006, 12:19
Default Re: Memory release
  #3
andy
Guest
 
Posts: n/a
> should one deallocate (delete) all the memory that has been allocated upto that point?

There is no requirement to do so. When the process is finished the operating system will return the memory for use by other processes.

> How important is it?

It is not important for performance.

It can have importance as a coding check. If you cannot easily free all allocated memory from the main controlling parts of you code it is probably an indicator of poor coding structure (but there are exceptions).
  Reply With Quote

Old   January 27, 2006, 13:43
Default Re: Memory release
  #4
Márcio Ricardo
Guest
 
Posts: n/a
In C++, If you're working with STL containers then you don't have to worry about that, because the destructors are called automatically by the program. On the other hand, if you're allocating your own arrays with the operator new, then you have to release the memory with the operator delete when you're not going to use them anymore, otherwise you can have segmentation fault problems.
  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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extend Project Release 1.6-ext hjasak OpenFOAM Announcements from Other Sources 33 July 14, 2011 18:54
release memory Ema CFX 2 June 30, 2009 17:15
Diesel combustion simulation ( Heat release rate) venkatesh CD-adapco 2 April 29, 2009 07:38
Memory error? Young CFX 3 September 30, 2008 11:33
CFX CPU time & real time Nick Strantzias CFX 8 July 23, 2006 17:50


All times are GMT -4. The time now is 22:29.