Kristian Lein-Mathisen scripsit:

> My C-snipped in foreign-primitive that's doing the stack-allocation is
> heavily inspired by
> http://wiki.call-cc.org/allocating-c-structures-under-control-of-the-chicken-gc.
> However, I've been getting feedback about this approach about it not being
> completely safe because it can't guarantee the stack won't overflow. 

I'm not sure that concern is reasonable.  The maximum stack size before
GC is 256K on 32-bit systems and 1M on 64-bit systems, but the actual
limit on the C stack on modern systems is many megabytes; even on 32-bit
Windows it is 1M.  So C stack overflow isn't very likely.

> 1. Is this method completely safe? If not, why is that the case? If not,
> how can you create blobs on the stack from C safely?

Since the stack is a limited resource, you cannot create Really Big blobs
on it safely.  In that situation, the heap is your only recourse.

-- 
A mosquito cried out in his pain,               John Cowan
"A chemist has poisoned my brain!"              http://www.ccil.org/~cowan
        The cause of his sorrow                 co...@ccil.org
        Was para-dichloro-
Diphenyltrichloroethane.                                (aka DDT)

_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to