CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   PtrList deletion (http://www.cfd-online.com/Forums/openfoam/60903-ptrlist-deletion.html)

grtabor September 22, 2007 04:12

Hi. I was wondering how to saf
 
Hi. I was wondering how to safely delete a PtrList? I ask because I have been writing a graphical front-end for blockMesh to display (at the moment) the block structure of a mesh from the blockMeshDict. It works pretty well now; however on exit from the code I get a load of error messages which I interpret as a traceback of an incorrectly-deleted object. There are quite a lot of pointers involved in the code, so I have been working (slowly) through the code making sure all are deleted correctly (something I really hate). However at the base level all the geometric information is held as PtrLists, and it occurred to me that I don't know how to delete these in a safe way. I've tried calling .clear() on them before they go, but that doesn't seem to make any difference. It may be that the error is somewhere else, but if anyone has any suggestions I'm all ears.

Gavin

hjasak September 22, 2007 17:55

Nothing to worry about - you h
 
Nothing to worry about - you hook (set) pointers into a PtrList and the list itself will worry about the deletion. Your error is elsewhere.

Try running

valgrind --tool=memcheck <app> <root> <case>

and you will get a more sensible message about first memory violation.

Hrv


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