PyMem_MALLOC (was [Python-Dev] Snake farm)

Marc Recht marc@informatik.uni-bremen.de
Fri, 22 Nov 2002 16:19:27 +0100


>> > So it looks like PyOblect_Free() was called with 0x800 as an argument,
>> > which is a bogus pointer value.  Can you go up one stack level and see
>> > what the value of k in function_call() is?
>> 713		if (ADDRESS_IN_RANGE(p, pool->arenaindex)) {
>> (gdb) up
>> # 1  0x080dfef4 in function_call (func=0x826317c, arg=0x8256aac,
>> kw=0x8269bdc) at Objects/funcobject.c:481
>> 481			PyMem_DEL(k);
>> (gdb) p k
>> $1 = (struct _object **) 0x800
>
> Well, then maybe you can follow MvL's suggestion and find out how come
> this value was returned by PyMem_NEW(PyObject *, 2*nk)???
The problem seems to be in the FreeBSD malloc implementation. malloc(0) 
returns 0x800 in all my tests. malloc(1) and up seems to work properly..

HTH,
Marc