For anyone interested: I'm trying to debug a memory problem in the
ctypes-python bindings Array class which models an apr_array_header_t
array. I suppose this class may never have worked properly, as it gets
exercised very little within the bindings and had no unit test cases
Running within its test suite it mostly works, but there appears to be a
problem in making a deep copy of, or holding onto a reference to, each
element when a new array is initialized.
A simple demonstration in the Python interpreter:
$ (cd subversion/bindings/ctypes-python/ && python -i
>>> from csvn.core import *
>>> from csvn.types import Array
>>> a1 = Array(c_char_p, ['one'])
The last line should have shown "Array(['one'])", but it printed garbage
from the Python interpreter's memory. This is so bad that I wonder if
my expectations are wrong.
The attached patch contains various changes and additions that I tried
unsuccessfully, and it adds tests that all pass (for me) except for the
places where they extend an Array with another (or the same) array.
Initially I thought the problem was only with self-referencing, because
I saw the failures in expressions such as "a1.extend(a1)", but now I am
noticing the same effect more widely.
Any hints appreciated.
Received on 2011-08-15 18:40:31 CEST