Page 1 of 1

How much RAM my applet needs

Posted: Tue Jan 17, 2017 11:09 pm
by cprgolds
I wonder how much RAM my applet will need. What consumes RAM in my applet? I can count the transient variables but how do I find out how much RAM for the stack I need?

Re: How much RAM my applet needs

Posted: Wed Jan 18, 2017 5:27 am
by Wardor
What consumes RAM in my applet?

transient variables, the stack,APDU buffer

I can count the transient variables but how do I find out how much RAM for the stack I need?

IMO, JCVM method stack is pre-allocated to a minimum size.
You can try to call the method JCSystem.getAvailableMemory(MEMORY_TYPE_TRANSIENT_RESET) within each method and save it to a shared byte array for output. But the method's parameters will also consume stack memory.

Re: How much RAM my applet needs

Posted: Wed Jan 18, 2017 6:21 am
by mabel
As far as I know, APDU buffer and stack consume pre-allocated RAM.

Re: How much RAM my applet needs

Posted: Thu Jan 19, 2017 12:06 am
by cprgolds
Thanks for all the answers. I have tried to call JCSystem.getAvailableMemory(MEMORY_TYPE_TRANSIENT_RESET) to know the approximate memory.