Manage memory and resource lifecycle
masterGlimmer DSL for LibUI handles much of the low-level resource management automatically:
- Automatic Cleanup: When a control is destroyed, it is automatically removed from its parent container (
horizontal_box,vertical_box,form,window, orgroup). - Data Binding: When a control with a data-binding is destroyed, the observer registration is automatically deregistered.
- Memory Management:
imageinstances andtablemodel instances are automatically freed after thewindowis destroyed.font_buttonandcolor_buttoncontrols automatically manage font descriptors and color value pointers.
- Garbage Collection: All controls are protected from Ruby's garbage collection until they are explicitly destroyed, ensuring stability during the GUI lifecycle.