releasing memory to malloc

Gabriel Genellina gagsl-py at yahoo.com.ar
Tue Sep 26 21:56:25 EDT 2006


At Tuesday 26/9/2006 22:17, iker.arizmendi at gmail.com wrote:

>I can, but the extension is only a thin wrapper around a general
>purpose C library which is also used independently of Python.

If you can recompile a specific version for using with Python, you 
can play with a few macros like

#ifdef USE_PYTHON_ALLOCATOR
#define my_malloc(s) PyMem_Malloc(s)
#else
#define my_malloc(s) malloc(s)
#endif

and change all bare malloc/realloc/free along the code to 
my_malloc/etc. (Chances are the code is using a special malloc 
spelling already, C guys tend to do such things...)
Then you can recompile it for use with or without Python.



Gabriel Genellina
Softlab SRL 


	
	
		
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas




More information about the Python-list mailing list