[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: mmap in guile -- guile memory management question
From: |
Neil Jerram |
Subject: |
Re: mmap in guile -- guile memory management question |
Date: |
Tue, 14 Nov 2006 23:38:17 +0000 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) |
Daniel Ridge <address@hidden> writes:
> What I would really like is the way in guile to create a string or a
> u8vector whose C data will not ever be free()ed by the garbage
> collector -- but I may be a user community of 1 on this point. What
> about relaxing must_free to accept a NULL pointer? If we did this, I
> could just whack the pointer in the guardian and the rest of the GC
> process would proceed normally.
>
> Is there any enthusiasm (for/against) in the user community for
> including mmap in libguile?
Yes from me; it sounds interesting and useful.
The architecture that springs to my mind for this is
- an mmap SMOB, which conceptually owns the mapped memory, and whose
free function would do the unmapping
- a shared array or uniform vector, which shares the SMOB's memory and
makes it available for manipulation through the array/vector API.
It looks like scm_t_array (in CVS HEAD) has the right structure
already to allow it to reference an arbitrary underlying object; the
details will need some hacking.
If possible, it would be nicer to implement this so that the mmap
support could be split into a separate library. (Or is in a separate
library to begin with.)
Regards,
Neil