|
[Sponsors] |
January 27, 2006, 11:23 |
Memory release
|
#1 |
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.
|
|
January 27, 2006, 12:01 |
Re: Memory release
|
#2 |
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.
|
|
January 27, 2006, 12:19 |
Re: Memory release
|
#3 |
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). |
|
January 27, 2006, 13:43 |
Re: Memory release
|
#4 |
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.
|
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
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 19:54 |
release memory | Ema | CFX | 2 | June 30, 2009 18:15 |
Diesel combustion simulation ( Heat release rate) | venkatesh | Siemens | 2 | April 29, 2009 08:38 |
Memory error? | Young | CFX | 3 | September 30, 2008 12:33 |
CFX CPU time & real time | Nick Strantzias | CFX | 8 | July 23, 2006 18:50 |