[viff-devel] Which operations for HSM (Hardware Crypto)
Martin Geisler
mg at daimi.au.dk
Thu Jul 17 02:28:24 PDT 2008
Brian Graversen <jobo at daimi.au.dk> writes:
> [...] All memory allocated locally using malloc will have to be
> free'd in C before returning, and then the return value is build
> using the python supplied function. It makes sure that refcount is
> incremented, and python then free's that python object when the last
> reference goes away, so all is well as I see it.
Yes, I'm pretty sure that works with no leaks.
About cleaning up memory, then it's only because you return a built-in
Python type that you have to free all allocated memory -- if we
instead made our own Python type, we could use the tp_dealloc member
to free the memory. I found a description of this here:
http://docs.python.org/ext/node27.html
http://docs.python.org/ext/node22.html
--
Martin Geisler
More information about the viff-devel
mailing list