Recent

Author Topic: Carbage collection  (Read 3084 times)

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Carbage collection
« on: April 24, 2010, 09:22:39 am »
Tried wiki search with words "freeing" "freed" "carbage" and same with forums come up with nothing useful so i need to ask about this "unknown" subject...

I have read that some objects may be freed automatically and question is what makes that happen? Does TForm free all object variables (for example TBitmap type) in public, private etc, does all classes free them? And what if i have same objects listed in another custom array and free them there, leaving class's variable not nil.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8700
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Carbage collection
« Reply #1 on: April 24, 2010, 10:00:24 am »
When a TComponent descendant is created, you supply one argument which is the Owner of the component. That Owner is responsible for freeing the component. Dropping a component (TButton, for instance) to a TForm automatically sets the button's owner to the form.

 

TinyPortal © 2005-2018