Skip to Main Content

JC3.0.5 JCSystem.makeGlobalArray() - garbage collection.

User_B9BBHMar 29 2021

The above method allows for the creation of a global buffer similar to the APDU buffer, but the reference to the global buffer can't be cached in instance variables, class variables or array components. I've encountered a few cards where the APDU buffer is only about 271 bytes long. I need to read in an entire 1K sized object and then process it - and I'm doing that often enough that I don't want to create a persistent object. With longer APDU buffers I can use those, but with these tiny 271 byte APDU buffers, I really need a work around.
Let's say I create a 1K global buffer in Applet.process(), pass that reference into a method that receives and processes the entire chunk. When process() returns, I lose my pointer to the buffer.
The question(s): do I need to call JCSystem.requestObjectDeletion() prior to return? Or, is that GC done automatically? E.g. am I going to run out global buffer space by calling the function each time process() is called? Or is something else supposed to happen?
I realize I can use the JCSystem.makeTransient(*)Array calls, but I'd like to avoid tying up RAM space when I don't have to.
Mike

This post has been answered by patrick.vh-Oracle on May 31 2021
Jump to Answer
Comments
Post Details
Added on Mar 29 2021
2 comments
56 views