Thursday, January 10, 2002 12:39 AM
I'm assuming you're talking about persistent data, not transient data.
As of Java Card 2.1.1, the standard doesn't provide garbage collection. So, EEPROM allocated using new will remained allocated "forever". This also means that when an object becomes unreferenced, its memory is lost "forever".
However, some platforms do provide proprietary GC, and it looks like JC 2.2 will feature GC as well.
Regarding your cases, I have no problem with case 3: this is indeed how it must work. The other two cases are not what I expected... I don't know what Java Card platform you're working on, but I would be really surprised it if failed to comply to the memory model ! Are you sure the amount of free EEPROM returned by the loader is really a dynamic value, i.e. is it really updated after each new ? Or does it just reflect the amount of EEPROM available to load other applets, in which case it wouldn't change ?
In any case, feel free to send me your code if you have any doubts.