|
From: David L. <dav...@cs...> - 2000-07-03 12:04:41
|
these look great! i will have to verify them..
some C functions incref their args for you, and others don't. there are
docs on which are which.
i think maybe i should convert things like PyList_Append to PySequence_SetItem
(with an appropriately allocated List). apparently they all have consistent
incref semantics and its much easier to visually check..
having problems with cvs at the moment...
209.81.8.43: Connection timed out
On Mon, 3 Jul 2000, David Margrave typed thusly:
> line 80 on should be:
>
> Py_DECREF( valuelist );
> }
> free(dn);
> }
> ldap_msgfree( m );
> return result;
> }
>
> this helps a bit, but something is still leaking memory like
> crazy elsewhere.
>
> I'm not able to do CVS just this moment, so could you add
> that in?
> Also in message.c, I added a Py_DECREF for valuestr:
>
> for (i=0; bvals[i]; i++) {
> PyObject *valuestr;
>
> valuestr = PyString_FromStringAndSize(
> bvals[i]->bv_val, bvals[i]->bv_len
> );
> PyList_Append( valuelist, valuestr );
> Py_DECREF(valuestr);
> }
>
> I'm not an expert on the python reference counting system, but adding this
> one has cleared up the memory leak (on openldap 1.2.10, compiled without
> caching and without threads. Haven't tried with yet..) I did try adding
> Py_DECREF in a couple other places and got core dumps. For some reason,
> it seems to be valid to do it here. Perhaps because the object in
> question is not a mapping or sequence? Anyhow, memory consumption on my
> program that does thousands of searches no longer goes up monotonically!
>
> Dave
>
--
David Leonard Dav...@cs...
Dept of Comp. Sci. and Elec. Engg _ Room:78-640 Ph:+61 7 336 51187
The University of Queensland |+| http://www.csee.uq.edu.au/~leonard/
QLD 4072 AUSTRALIA ~` '~ E2A24DC6446E5779D7AFC41AA04E6401
Curses! - Mojo Jojo
|