So I guess the crux of the issue is whether or not the library and the Nim are isolated memory wise. If yes, then the library gives over "ownership' of something to Nim, and Nim now has total control and freedom to free when outside of its own scope. However if not isolated, then Nim could free things the library actively relies on and lead to undefined behavior very quickly. In that case you'd need to represent the structure of the C in Nim so it knows when it's allowed to free things, and that would be a manual part of a wrapper on top of the 1 to 1 bindings.