[Pyrex] Mem problem.

Pere Urbón Bayes purbon at deic.uab.cat
Tue Oct 3 07:38:52 UTC 2006


Dear pyrex community, my name is Pere and I'm porting an internal lib to
 python via pyrex. I could port a little part ( the simple case ) but
when I try to do it with the large case it doesn't work. When I run with
the large case I get all the time this error:

purbon at ccd-purbon:~/workspace/ubc/PyUBC$ ./test.py
1024
<type 'list'>
*** glibc detected *** free(): invalid next size (normal): 0x081567a0 ***
Avortat

this could mean that the code was running ok but when python is freeing
the memory there may be some error that i could not find (Im newby with
python and pyrex, ;>).

When I run this case with gdb the bt is:

(gdb) run test.py
Starting program: /usr/bin/python test.py
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread -1210119968 (LWP 5882)]
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
1024
<type 'list'>
*** glibc detected *** free(): invalid next size (normal): 0x081567a0 ***

Program received signal SIGABRT, Aborted.
[Switching to Thread -1210119968 (LWP 5882)]
0xb7e19947 in raise () from /lib/tls/libc.so.6
(gdb) bt
#0  0xb7e19947 in raise () from /lib/tls/libc.so.6
#1  0xb7e1b0c9 in abort () from /lib/tls/libc.so.6
#2  0xb7e4efda in __fsetlocking () from /lib/tls/libc.so.6
#3  0xb7e5689f in mallopt () from /lib/tls/libc.so.6
#4  0xb7e56942 in free () from /lib/tls/libc.so.6
#5  0x0807a459 in PyLong_FromDouble ()
#6  0x0807bdd5 in PyDict_SetItem ()
#7  0x08101e94 in _PyModule_Clear ()
#8  0x080d20c4 in PyImport_Cleanup ()
#9  0x080dc48e in Py_Finalize ()
#10 0x08055824 in Py_Main ()
#11 0x08055032 in main ()

and the source code involved with pyrex is:

if wordLength <= UnsignedIntLength:
	#We are working with an small code
	smallCode=small_kernel(p,wordLength,codeCardinal,...)
	codi = scCode2pCode(smallCode,codeCardinal,limbs)
else:
	#Our code is on the large side.
	largeCode = large_kernel(p,wordLength,codeCardinal,...)
	codi = lcCode2pCode(largeCode,codeCardinal,limbs)
	
return codi

if i take out the large_kernel function then the case works good ...
this could make me supose that the problem could be with the lib, but if
 i run the binary generated with the lib it run without problems.

PD: Sorry for my english, I'm not so good :<..

Regards,

-- 
|---------------------------------------------------------------.--.
|Pere Urbón Bayes      JabberID: purbon at jabber.org             |o_o |
|Dept. of Information and Communication's Engineering          |:_/ |
|E.T.S. d'Enginyeria. Autonomous University of Barcelona      //   \ \
|08193 Bellaterra, Cerdanyola del Valles (Catalonia)         (|     | )
|Tel: +34935813573 QC/2005 (Combinatoric and Coding Group)  /'\_   _/`\
|-----------------------------------------------------------\___)=(___/




More information about the Pyrex mailing list