[pypy-svn] r51447 - pypy/dist/pypy/lib/_ctypes

fijal at codespeak.net fijal at codespeak.net
Wed Feb 13 18:13:06 CET 2008


Author: fijal
Date: Wed Feb 13 18:13:06 2008
New Revision: 51447

Added:
   pypy/dist/pypy/lib/_ctypes/keepalive.txt   (contents, props changed)
Log:
Draft for document describing keepalive behavior of ctypes.


Added: pypy/dist/pypy/lib/_ctypes/keepalive.txt
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/lib/_ctypes/keepalive.txt	Wed Feb 13 18:13:06 2008
@@ -0,0 +1,16 @@
+
+Few rules about ctypes keepalives:
+
+* Ownership: the memory is freed when owner of this memory is deleted.
+  Owner is the one who allocated the memory. So if we have:
+
+  a = c_int(3)
+  b = c_int.from_address(a._buffer.buffer) # pypy notion of address access
+
+  only a frees memory.
+
+* _objects: each ctypes object has (eventually) _objects dictionary in which
+  it simply keeps objects to be kept alive.
+
+* there are (some) rules about when to put stuff in it's objects when
+  accessing the fields etc. need to list them here.
\ No newline at end of file



More information about the Pypy-commit mailing list