Subject:
[ruby-ffi] Freeing memory allocated by underlying library (libxml dumpDocFormatMemory)
From:
Paul Hinze
Date:
2/5/13 12:39 PM
To:
ruby-ffi@googlegroups.com

Hi folks!

I'm trying to figure out how i'm supposed to free memory when i get a pointer to a string buffer allocated by my underlying library.

https://github.com/phinze/xml_security/blob/ebd1743f7ab493b6565137ace8d60ad3e5bac52b/lib/xml_security.rb#L216-L224

The docs for xmlDocDumpFormatMemory say it's my responsibility to free the allocated memory with xmlFree [1]. But if i try to call xmlFree on the ptr or the strptr i get segfaults, and MemoryPointer#free seems to not cork the leak.

Any guidance would be much appreciated,

Paul Hinze


[1] http://xmlsoft.org/html/libxml-tree.html#xmlDocDumpFormatMemory


--
 
---
You received this message because you are subscribed to the Google Groups "ruby-ffi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-ffi+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.