Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4809540

RFE: permit allocation of new objects on stack

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.4.1
    • specification
    • x86
    • windows_nt

      Name: rmT116609 Date: 01/28/2003


      A DESCRIPTION OF THE PROBLEM :
      In java, most particularly in GUI programming, one frequently allocates large numbers of small objects which are only used in a local scope. The new garbage collection algorithm goes a considerable way toward solving the performance problems associated with this. However, perhaps the language could support allocating variables on the call stack, perhaps implemented internally with another stack parallel to the call stack.

      I suggest:

      1) That allocation on stack be introduced by adding the "transient" modifier to the "new" keyword

      Object foo = new transient Bar();

      2) That it be a *run-time* error to assign a transient reference to an instance variable

      3) That it be possible to mark classes at compile time as not accepting transient references as method arguments. This prevents existing libraries being broken by being passed arguments that will throw exceptions that existing
      code does not expect.

      (Review ID: 180494)
      ======================================================================

            abuckley Alex Buckley
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: