Fix memory leaks in GLib callback functions #205
No reviewers
Labels
No labels
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
java
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
java-gi/java-gi!205
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "glib-callback-memory-leaks"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The GLib functions
g_idle_add_once,g_timeout_add_onceandg_timeout_add_seconds_oncedon't notify the caller when the callback function has finished. This causes a memory leak in Java-GI, because the arena in which the callback upcall stub was allocated, is never closed.Because these three functions are simple wrappers around
g_idle_add_full,g_timeout_add_fullandg_timeout_add_seconds_full, which do notify the caller to free the callback allocation, they have been reimplemented in Java as custom wrappers that call the "full" functions and then returnG_SOURCE_REMOVE.