Re: [pypy-dev] swig + pypy - object reference counting

2011-09-28 Thread Amaury Forgeot d'Arc
2011/9/28 Alex Pyattaev > Py_XINCREF(resultobj); > What is this call doing? It should not be necessary, since you called PyTuple_New. This may explain why it does not crash with CPython: the tuple object always leaks but happens to keep the necessary reference to the global object. (PyPy do

Re: [pypy-dev] swig + pypy - object reference counting

2011-09-28 Thread Alex Pyattaev
Well, the point is that first I make an owned copy of the object: %typemap(in) void* { Py_XINCREF($input); $1 = $input; } Here is the storage struct: struct event{ int code; void* node_tx; void* node_rx; void* packet; double signal_power; double noise_power; doub

Re: [pypy-dev] swig + pypy - object reference counting

2011-09-28 Thread Amaury Forgeot d'Arc
2011/9/28 Alex Pyattaev > Hi! > I have a quite sophisticated program that can be summarized as follows: > 1. Save a pypy object pointer inside C program. Here I call Py_XINCREF so > that > it does not get deleted. > 2. Do some logic, move this reference around C code. > 3. Return a python tuple v

[pypy-dev] swig + pypy - object reference counting

2011-09-28 Thread Alex Pyattaev
Hi! I have a quite sophisticated program that can be summarized as follows: 1. Save a pypy object pointer inside C program. Here I call Py_XINCREF so that it does not get deleted. 2. Do some logic, move this reference around C code. 3. Return a python tuple via typemap, here I am probably supposed