[Ironpython-users] Delete a large object in ironpython, and releasing the memory?

Steve Baer steve at mcneel.com
Tue Dec 22 01:19:14 EST 2015


Sorry, I don't know what specifically will force the clean up of those points. Typically you shouldn't have to care and the garbage collector will do it's job when the memory pressure is high enough.


> On Dec 21, 2015, at 4:18 PM, Djordje Spasic <issworld2000 at yahoo.com> wrote:
> 
> Thank you Steve.
> What about the points from which the mesh is made (a regular python lists with Point3d objects in it).
> Should I use the "del" statement to delete them, and then call gc.collect() afterwards?:
> 
> import gc
> del meshPts  # meshPts is a python list containing Point3d objects from which the "largeMesh" is made
> gc.collect()
> largeMesh.Dispose()
> 
> ?
> 
> Thank you.
> Djordje Spasic
> 
> 
> 
> From: Steve Baer <steve at mcneel.com>
> To: "ironpython-users at python.org" <ironpython-users at python.org> 
> Sent: Monday, December 21, 2015 6:35 PM
> Subject: Re: [Ironpython-users] Delete a large object in ironpython, and releasing the memory?
> 
> In this case, the class that you are referring to is IDisposable. Call the Dispose function on the Mesh instance when you are done with it.
> 
> -Steve
> 
> Steve Baer
> Robert McNeel & Associates
> www.rhino3d.com
> 
> On Sun, Dec 20, 2015 at 4:00 AM, Djordje Spasic via Ironpython-users <ironpython-users at python.org> wrote:
> I am a creating a huge mesh object (some 900 megabytes in size) in Rhino3d application by using its ironpython 2.7 interpreter.
> Once I am done with analysing this mesh, I would like to somehow delete it from the memory.
> 
> I did a bit of search on stackoverflow.com, and I found out that "del" statement will only delete the reference to mentioned mesh. Not the mesh object itself.
> And that after some time, the mesh object will eventually get garbage collected. At least this is what some users on stackoverflow say about the regular cpython.
> 
> Is "gc.collect()" the only way by which I could instantly release the memory, and there for somehow remove the mentioned large mesh from the memory?
> I've also found replies on stackoverflow.com which state that "gc.collect()" should be avoided (at least when it comes to regular python, not specifically ironpython).
> I've also find comments on stackoverflow which claim that in IronPython it is not even guaranteed the memory will be released if nothing else is holding a reference.
> 
> Any comments on all these issues?
> 
> Is it even possible to instantly free the memory from the deleted large object in ironpython (2.7)?
> 
> Thank you for the reply.
> 
> Kind regards,
> Djordje Spasic
> 
> 
> _______________________________________________
> Ironpython-users mailing list
> Ironpython-users at python.org
> https://mail.python.org/mailman/listinfo/ironpython-users
> 
> 
> 
> _______________________________________________
> Ironpython-users mailing list
> Ironpython-users at python.org
> https://mail.python.org/mailman/listinfo/ironpython-users
> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20151221/7f5d5276/attachment.html>


More information about the Ironpython-users mailing list