chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Fixed stack size


From: Felix
Subject: Re: [Chicken-users] Fixed stack size
Date: Thu, 10 Feb 2011 20:09:23 +0100 (CET)

From: address@hidden
Subject: [Chicken-users] Fixed stack size
Date: Wed, 09 Feb 2011 20:41:19 +0100

> Hi,
> 
> I am developing an application for an embedded device with chicken
> scheme 4.6.3. My program should use a fixed size of memory. I restrict
> heap usage with -:h500k .
> 
> ./loop 10000 -:h500k -:hm500k -:hs0 -:hg0 -:D
> ...
> [debug] heap resized to 512000 bytes
> ...
> [debug] stack resized to 131072 bytes
> 
> With a lower heap size:
> 
> ./loop 100000  -:h50k -:D
> ...
> [debug] resizing heap dynamically from 51k to 500k ...
> 
> the heap size is changed. That is fixed with -:hm50K. But if i want a
> fixed stack size then my application terminates with:
> 
> ./loop 100000 -:h500k -:hm500k -:s200K -:D
> 
> [panic] out of memory - cannot allocate vector (heap resizing
> disabled) - execution terminated
> 
> No stack resize message is shown for debug. Even a greater stack size
> of 2 or 8 MByte has the same effect. Why?
> 

Data of a certain size will always be allocated in the heap,
regardless of stack size (it will have to be copied into
the heap on GC anyway).

Does a larger limit help? What memory requirements do you have? 500k
is not very much.  You can use a variable heap size and execute
`(print (##sys#memory-info))' at a few places in your code to see how
the heap is growing and where (the first number in the 2-element
vector returned is the current heap-size).


cheers,
felix



reply via email to

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