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

PtrList deletion

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

Reply
 
LinkBack Thread Tools Display Modes
Old   September 22, 2007, 04:12
Default Hi. I was wondering how to saf
  #1
Senior Member
 
Gavin Tabor
Join Date: Mar 2009
Posts: 181
Rep Power: 8
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, 17:55
Default Nothing to worry about - you h
  #2
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,758
Rep Power: 21
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
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
PtrList initialization problem mateusz_slowikowski OpenFOAM Running, Solving & CFD 8 March 19, 2012 15:32
SnappyHexMesh region deletion monkeytron OpenFOAM Mesh Utilities 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 17:30


All times are GMT -4. The time now is 20:10.