[Ecls-list] Foreign variables setting problem

Goffioul Michael goffioul at imec.be
Mon Oct 24 05:17:52 UTC 2005


> One should use free(). For that maybe one should add a flag in
> foreign_data, as in
> 
> struct ecl_foreign {		/*  user defined datatype  */
> 	HEADER1(malloced);	/*  allocated with malloc()?  */
> 	cl_object tag;		/*  a tag identifying the type  */
> 	cl_index size;		/*  the amount of memory allocated  */
> 	char *data;		/*  the data itself  */
> };

Here's a patch that implements it. With it, ECL passes all CFFI tests.
However, to be honest, I don't really like this solution because it can
easily lead to memory leaks, at least in CFFI. It'd be better if CFFI
would keep a static reference to foreign vars to prevent the memory from
being collected.

Shall I commit?

Michael.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffialloc.diff.bz2
Type: application/octet-stream
Size: 1751 bytes
Desc: ffialloc.diff.bz2
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20051024/9c76ed85/attachment.obj>


More information about the ecl-devel mailing list