[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Order of _free calls on objects perhaps broken


Le 12/01/2025 à 19:43, Brian G a écrit :
When gambas exits a program it releases objects by calling the _free() function in each object if present.

No, it's the contrary: '_free()' is called when the object is released. '_free()' does not release anything.


This method is not starting from the main application downward, but appears to go linearly through an internal list of objects calling the _free() as it goes along.

At the end of the event loop, all global static objects of each class are dereferenced.

If there is still non-free objects after that process, that means you have circular references. Gambas can't solve them, it just emits a warning in that case before quitting.

You must not create circular references in your code.

It's a bug, but normally in your code, not in Gambas - unless something inside Gambas native code forgets to release a reference.

Regards,

--
Benoît Minisini.


References:
Order of _free calls on objects perhaps brokenBrian G <brian@xxxxxxxxxxxxxxxx>