The 'Pawn Language' Forum

An embedded scripting language

 

Back To Forum Index
 
Boris Estudiez
Posted On 2009-07-29 15:10 -- Subject: Reduce Heap/Stack Size Requirement

Hi,

I'm trying to compile this simple script:

#include "leds.inc"

#pragma amxlimit 12288 // 12 KB available for code.
#pragma amxram 4096 // 4 KB available for data+stack.

main()
{
LedToggle(LED1) // Toggle a LED.
}

The compiler gives the following output error:

fatal error 106: compiled script exceeds the maximum memory size
(16384 bytes).

Header size: 76 bytes
Code size: 44 bytes
Data size: 0 bytes
Stack/Heap size: 16384 bytes, estimated max. usage=6 cells (24 bytes)
Total requirements: 16504 bytes

1 Error
Failure, return code 1

If the estimated max. Stack/Heap usage is 24 bytes,
then Why this simple script needs 16 KB of Stack/Heap ?.

How I can reduce the Stack/Heap size requirement
at compile time to < 4KBytes ?.

Note: The abstract machine is running in an embedded system.

Regards,
Boris Estudiez.-

www.slicetex.com.ar





incrediball
Posted On 2009-08-06 03:14 -- Subject: RE: Reduce Heap/Stack Size Requirement

You have set the maximum RAM allowed to 4K but the stack being allocated is still 16K, hence the error. To change the stack size, use #pragma dynamic
Boris Estudiez
Posted On 2009-08-10 10:52 -- Subject: RE: Reduce Heap/Stack Size Requirement

Thanks incrediball!

You Are On Page: 1/1 <<   <   1   >   >>




- BiTBOARD version 2.5 by the BiTSHiFTERS SDC -