OO and game design questions

Benjamin Kaplan benjamin.kaplan at case.edu
Mon Oct 18 11:10:46 EDT 2010


On Mon, Oct 18, 2010 at 9:50 AM, dex <josipmiskovic at gmail.com> wrote:
>> You're aware Python can collect reference cycles, correct?  You don't
>> have to delete references; Python will get them eventually.
>
> I'm not sure I understand this part? If I don't delete all strong
> references, the object will not be deleted.
> It will persist and occupy memory as long as there's at least one
> reference to it (it could be part of inventory, or target of some
> action).
>

No it won't. Python has a garbage collector. The object will persist
as long as it is reachable through code. If it becomes unreachable,
the garbage collector will delete it even if there is a reference
cycle.



More information about the Python-list mailing list