[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Declare large expressions as read-only and not gc-ab
Re: [Chicken-users] Declare large expressions as read-only and not gc-able?
Sun, 5 Jan 2014 18:48:27 +0100
On Sun, Jan 05, 2014 at 06:07:33PM +0100, Sven Hartrumpf wrote:
> Hi all.
> Is there a recommended way to declare some large expressions (> 100 MB)
> in a compiled program as read-only and more importantly
> as not gc-able (the garbage collector should be saved from traversing
> these large structures again and again)?
> Should the constant value be compiled in or should it be read from a file?
> Is define-constant the right way to go?
> (How do other Scheme implementation handle such cases?)
I don't know if define-constant helps. I don't think it does,
but I might be wrong. Perhaps you can use object-evict!, but
that means it won't ever be reclaimed by the GC. I haven't used
this myself yet, so I don't know if there's a way to "un-evict" the
object when it can be GC'ed.
Depending on the task, you could also just malloc some foreign object
and provide foreign-lambda or foreign-primitive accessors to reach
into the object.