Forum Stats

  • 3,724,396 Users
  • 2,244,747 Discussions
  • 7,850,993 Comments

Discussions

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

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

User_B9BBH
User_B9BBH Member Posts: 55 Blue Ribbon

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

Sign In or Register to comment.