[Gambas-user] What are circular references, and how to avoid?

Benoit Minisini gambas at ...1...
Tue Jan 22 11:42:53 CET 2008


On mardi 22 janvier 2008, Jaap Cramer wrote:
> Hi
>
> I have a question. I Got, after exiting a fine working project this message
> in console:
>
> WARNING: circular references detected
> FToolBar (3)
> FHistory (1)
> FBible (1)
> FOptions (1)
> FLoad (1)
> ToolPanelContainer (3)
> FExpander (1)
> ToolPanel (1)
> Expander (1)
> WARNING: 251 allocation(s) non freed.
>
> What is it
> how serious is this :-)
> and how do I avoid it?
>
> Jaap
>

Easy, you avoid it by not creating circular references. :-)

A circular reference is when an object A has a variable that points at an 
object B, and that at the same time the object B has a variable that points 
at the object A. 

The interpreter is not clever enough to deal with that, and cannot free the 
two objects. It just can print a warning at the end of the program, and write 
the list of classes having objects non freed.

Regards,

-- 
Benoit Minisini




More information about the User mailing list