CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

PtrList deletion

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 22, 2007, 05:12
Default Hi. I was wondering how to saf
  #1
Senior Member
 
Gavin Tabor
Join Date: Mar 2009
Posts: 181
Rep Power: 17
grtabor is on a distinguished road
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
grtabor is offline   Reply With Quote

Old   September 22, 2007, 18:55
Default Nothing to worry about - you h
  #2
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,902
Rep Power: 33
hjasak will become famous soon enough
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
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
PtrList initialization problem mateusz_slowikowski OpenFOAM Running, Solving & CFD 8 March 19, 2012 15:32
[snappyHexMesh] SnappyHexMesh region deletion monkeytron OpenFOAM Meshing & Mesh Conversion 2 February 19, 2009 23:57
Hook function of PtrList in OF 15 pawel OpenFOAM Running, Solving & CFD 2 January 9, 2009 04:21
What is the equivalent of hook function of PtrList in v14 liu OpenFOAM Running, Solving & CFD 1 May 30, 2007 18:30


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