go-gst
go-gst copied to clipboard
memory leak
Hi,
I am checking memory allocation & release with debug/pprof tool.
And I found that heap profiler indicates following heap stack.
0: 0 [2: 48] @ 0x4613e53 0x45e5fe9 0x481deb1 0x4076681
# 0x4613e52 github.com/tinyzimmer/go-gst/gst.NewBufferFromBytes.func1+0x52 /Users/bkim/go/pkg/mod/github.com/tinyzimmer/[email protected]/gst/gst_buffer.go:101
# 0x45e5fe8 github.com/tinyzimmer/go-gst/gst.NewBufferFromBytes+0x48 /Users/bkim/go/pkg/mod/github.com/tinyzimmer/[email protected]/gst/gst_buffer.go:101
This is because Extract() returns C.GoBytes() which underlying array is a copy of the array in C area.
And I couldn't find anywhere doing free for it.
Please help me whether or not I have right understanding.
https://github.com/tinyzimmer/go-gst/blob/5437f8a654ee228e8959fb52d6cbc6f5c14123a2/gst/gst_buffer.go#L387-L394
I would expect the defer C.free(dest) to be taking care of it, but this is an interesting case indeed. Will warrant a closer look.
@brucekim move this issue to https://github.com/go-gst/go-gst (where future development of the bindings will take place) if it is still necessary