How to prevent pixbuf memory leaks in c wrappers?

So I checked multiple wrappers for GTK3, I’m fairly new to GTK3 and I was told scaling pixbufs would clog the memory after each scale.

Is there a way to release the older version of scaled pixbuf everytime it’s replaced?

(I’m using Golang GTK3 wrapper gotk3)

I guess you should ask the gotk3 people. Automatic realtime releasing of resources can be hard, as GarbageCollectors may have a delay. An example is the GtkDrawingArea when temporary surfaces are used. Was a problem with Ruby ten years ago, and is some problem for Nim with the default GC – I have noticed that without manually destroying surfaces up to 3 GB of RAM can be allocated before the GC becomes active and frees all that. So we had in the past a user available destroy function. Luckily, with Nim’s new ARC/ORC deterministic memory management that problem is gone. I would guess that Rust has no problems too.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.