|
[Sponsors] |
July 17, 2020, 06:05 |
freeing objects in OpenFOAM
|
#1 |
Senior Member
Gerry Kan
Join Date: May 2016
Posts: 347
Rep Power: 10 |
Howdy Foamers:
In a function I declared an instance of DynamicList. Textbook C++ told me that I should be deallocating this in the class destructor or, when it is declared in a function, I should delete it once it is not used anymore. However, I don't see anything to that effect. The question is, do I have to do this, or these are being done "ad hoc" somewhere in the OpenFOAM code? Thanks in advance, Ed. |
|
July 19, 2020, 14:10 |
|
#2 |
Senior Member
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 21 |
Heap memory is deallocated in the destructor of List class which DinamicList class is derived from. Take a look:
template<class T> Code:
Foam::List<T>::~List() { if (this->v_) { delete[] this->v_; } } |
|
July 20, 2020, 02:41 |
|
#3 |
Senior Member
Gerry Kan
Join Date: May 2016
Posts: 347
Rep Power: 10 |
Dear Sergei:
It looks like I still have to learn how to traverse the OpenFOAM object inheritance tree. Thank you very much for pointing that out and this put my mind at ease with your response. Sincerely yours, Gerry. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Transforming Multi objects in Fluent to openfoam??? | umdj@keri.re.kr | OpenFOAM | 0 | June 21, 2016 05:05 |
OpenFOAM Training Beijing 22-26 Aug 2016 | cfd.direct | OpenFOAM Announcements from Other Sources | 0 | May 3, 2016 04:57 |
OpenFOAM Foundation Releases OpenFOAM v2.3.0 | opencfd | OpenFOAM Announcements from OpenFOAM Foundation | 3 | December 23, 2014 03:43 |
OpenFOAM Foundation releases OpenFOAM 2.2.2 | opencfd | OpenFOAM Announcements from ESI-OpenCFD | 0 | October 14, 2013 07:18 |
Modified OpenFOAM Forum Structure and New Mailing-List | pete | Site News & Announcements | 0 | June 29, 2009 05:56 |