Page 1 of 1

Commands to get free and used memory sizes in Java card

Posted: Mon Apr 11, 2016 5:17 am
by maheshk
Hi,
I have created one applet which runs fine on Java card. Now I want to know how much EEPROM is free/used. Also I want to know free/used ROM size if possible. Is there any way to know how much RAM any applet uses at run time?
Please suggest if any JCshell commands or Java Card applet commands are available to find out these details.
Thank you.

Re: Commands to get free and used memory sizes in Java card

Posted: Mon Apr 11, 2016 11:36 pm
by trgorce
maheshk wrote:Hi,
I have created one applet which runs fine on Java card. Now I want to know how much EEPROM is free/used. Also I want to know free/used ROM size if possible. Is there any way to know how much RAM any applet uses at run time?
Please suggest if any JCshell commands or Java Card applet commands are available to find out these details.
Thank you.


As far as I know, there is no ready command to get these information. But you can ask your card provider to offer these command.

Re: Commands to get free and used memory sizes in Java card

Posted: Tue Apr 12, 2016 12:36 am
by maheshk
I'm using SmartMX J3D081 Java card (with JCOP v.2.4.2 R2 and Java card open spec v.3.0.4). I didn't find any information regarding this in their documents.
If there are no readymade commands, is there any other way to get this information?

Re: Commands to get free and used memory sizes in Java card

Posted: Tue Apr 12, 2016 6:14 am
by Ellisun
maheshk wrote:I'm using SmartMX J3D081 Java card (with JCOP v.2.4.2 R2 and Java card open spec v.3.0.4). I didn't find any information regarding this in their documents.
If there are no readymade commands, is there any other way to get this information?



There are three types memory sizes, you can write an applet to get these memory sizes, the API function is:

JCSystem.getAvailableMemory(byte memoryType);

and the memoryType are JCSystem.MEMORY_TYPE_PERSISTENT, JCSystem.MEMORY_TYPE_TRANSIENT_RESET and JCSystem.MEMORY_TYPE_TRANSIENT_DESELECT.