Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9143667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:04:51+00:00 2026-06-17T10:04:51+00:00

In Java Card (I’m interested in Classic downto 2.1.1), transient (RAM) needed by an

  • 0

In Java Card (I’m interested in Classic downto 2.1.1), transient (RAM) needed by an applet is typically allocated on install by makeTransientByteArray(). That method accepts a parameter CLEAR_ON_RESET or CLEAR_ON_DESELECT. The later comes with warning that

CLEAR_ON_DESELECT transient objects can be accessed only when the applet which created the object is in the same context as the currently selected applet.

The Java Card runtime environment will throw a SecurityException if a CLEAR_ON_DESELECT transient object is accessed when the currently selected applet is not in the same context as the applet which created the object.

My reading is that CLEAR_ON_DESELECT (but not CLEAR_ON_RESET) would allow the runtime to overlay the transients (allocated on install as stated above) between two applets, as long as they are not simultaneously selected, so that several applets allocating mj bytes would consume about max(mj) transient bytes, rather than sum(mj).

Update: I’m told something on the tune that on at least some runtime environments, the overlay occurs selectively for transients allocated from different packages. But I fail to find a reference, or a precise description of such rule/mechanism.

Question: Is this overlay mechanism sometime implemented in the runtime? If yes, when does it occurs? And are there cards with a runtime not implementing it? If yes, is there a way to tell other than by experiment, maybe from the version of Java Card advertised?

Other question: Precisely what does “context” mean in the quoted restriction? In particular, is a CLEAR_ON_DESELECT transient usable by another instance of the applet, sharing it with the instance that allocated by the mechanism shown here? Note: I’m not interested in sharing the content of the transient, only in avoiding two allocations, to workaround a possible lack of overlay by the runtime.

Update: I asked the same question here and got an interesting answer.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T10:04:52+00:00Added an answer on June 17, 2026 at 10:04 am

    There is no direct reason for Oracle to specify that CLEAR_ON_DESELECT can be used to share memory between different applet instances, but it would be a very weird implementation if it didn’t allow that to happen.

    If it is specified anywhere, it is probably in the testing tools that Oracle makes available to companies implementing Java Card. Actually, the actual underlying memory model is not specified by Oracle at all, it’s up to the implementation if they want to e.g. align data. Java Card byte code & CAP file format must be supported, but that’s about it regarding the underlying implementation.

    As for the context, from the VM specs:

    There is a one-to-one mapping between contexts and packages in which
    applets are defined. An easy way to think of a context is as the
    runtime equivalent of a package, since Java packages are compile-time
    constructs and have no direct representation at runtime. As a
    consequence, all applet instances from the same package will share the
    same context.

    Note that this does not mean that a CLEAR_ON_DESELECT array won’t be cleared if the applet is deselected in any way. This is just about access conditions. I will have to find out, but I guess if another applet in the same context uses the array, it will only be able to see zero’ed out bytes.

    But this part about CLEAR_ON_DESELECT and context is just how I read the specs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have java application that sending( HTTP post method ) credit card numbers to
I am looking for java example solution/library/class for online card game. I'm interested in
The task is to implement a Java Card application (Applet) with biomentric (fingerprint)-based security.
I am writing a java smart card application in windows MFC. How do i
I am writing a card game in java where I need to spread cards
I'm working with Card Verifiable Certificates in Java (using PrimeKey/EJBCA's cert-cvc library ) which
I currently have a multiplayer card game developed and working in Java and it
Possible Duplicate: Why is using a wild card with a Java import statement bad?
I want to know how a smart card application can be done using Java
I have a Java program that auto dials phone numbers, it can generate sounds

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.