> Alright, the lifetime of the widgets in question is the 
> liftime of the code, as are the strings I dynamically malloc, 
> so then yes, the OS will free everything when the code exits.

Yes, that's the way it works. In that circumstance, generally the only
things you need to explicitly delete are resources that the OS will not
automatically release (e.g. things like file locks and so forth,
perhaps.)

Memory based resources (widgets, strings, etc) the OS will recover
automatically, so you do not need to explicitly release these resources.
Of course, you can if you want to!

> Do the fltk widgets that u *new* within the top window get 
> freed in this fashion upon exit? Or does fltk use some trick 
> to delete the top level window upon exit, so that all 
> children get destroyed?

Both, depending on circumstance.

If you simply let the program exit (without destroying your top level
widget) then the OS will reap the resources automatically.

If you explicitly delete the top level widget, it will reap all the
children for you, so you do not have to.

> I currently don't have any locally declared widgets, pretty 
> much everything is getting newed. The class I made is just a 
> wrapper for it all.

That's one of the preferred patterns, I think, and should work fine.




SELEX Sensors and Airborne Systems Limited
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 
3EL
A company registered in England & Wales.  Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to