[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Making stack-allocated Chicken-managed objects from

From: John Cowan
Subject: Re: [Chicken-users] Making stack-allocated Chicken-managed objects from C
Date: Tue, 6 Mar 2012 12:31:50 -0500
User-agent: Mutt/1.5.18 (2008-05-17)

Kristian Lein-Mathisen scripsit:

> My C-snipped in foreign-primitive that's doing the stack-allocation is
> heavily inspired by
> 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!"    
        The cause of his sorrow                 address@hidden
        Was para-dichloro-
Diphenyltrichloroethane.                                (aka DDT)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]