Dear Marc,

I see in https://github.com/gambit/gambit/blob/master/lib/mem.c#L1621-L1636 that actually ___alloc_scmobj is a wrapper for ___alloc_scmobj_still, great that clarifies that aspect.

Just curious, when ___ps == NULL it has custom behavior (specifically it will wrap to ___alloc_scmobj_perm instead). In what situation would ___ps ever be NULL?

Thanks,
Phil

On Mon, Oct 12, 2020 at 10:01 AM Phillip Suero <philsuero@gmail.com> wrote:
Dear Marc,

I am sending over an u8vector from the Scheme world to the C world.
Of course the u8vector must be still, so that its heap allocated object's memory address is not moved by Gambit's memory system.
To get clear on this topic, I have three quick questions for you:

(1) I see there's the function |##still-copy| in Gambit's runtime.
Browsing its code I don't see the keyword ___STILL mentioned anywhere in it. How does it get the ___STILL property, is that an implicit argument to ___alloc_scmobj ?

(2) Is |##still-copy| a "universal copier" of any heap allocated object, into an equivalent of itself that is ___STILL, so I can use it for, say, u32vector, floating point number, complex number, string, Scheme struct?

(3) Is there any checker in Gambit's runtime, e.g. a |##still?|, whereby I can check if a heap allocated object is ___STILL already?

Your clarification is much appreciated, thanks!
Phil