Ticket #1167 (new task)
Think about resource management
| Reported by: | guest | Owned by: | axel |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.0 |
| Component: | general (Gtk+, Glib) | Version: | 0.10.2 |
| Keywords: | Cc: |
Description
It is very easy to get a memory leak. For example these buttons will never get freed:
replicateM_ 1234 $ do
b <- buttonNew
onStateChanged b $ \_ -> widgetGetSize b >>= print
You can correct this example with eventGetWindow, but that doesn't apply to signals.
The memory leaks in a typical app are small. However, avoiding these leaks may involve API changes so it's important to think about. I suggest, at least, an explicit "objectUnref" action that cancels the finalizer. Then app writers can take care of memory management.
As a nicer API, since a UI is just a tree, perhaps Containers could automatically manage the refs for their children.
Change History
Note: See
TracTickets for help on using
tickets.