You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think this is wrong. You're always deferring C.free(nil) here. The arguments to a defer are evaluated at defer time, not at execution time. You would need the defer call after the C.encode_to_string call. Or wrap the deferred function in a func() (I think, defer func() { C.free(unsafe.Pointer(d)) }()).
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I'm tring to call CGO function in my program, but it seems that cause memory leaks.
What did you expect to see?
The memory of benchmark program is increasing perpetually.
defer_c_free.mov
What did you see instead?
The memory of benchmark program is kept in some low level.
The text was updated successfully, but these errors were encountered: