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

RFE: permit allocation of new objects on stack

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 1.4.1
    • Fix Version/s: None
    • Component/s: specification
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_nt

      Description

      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)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: