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

Should not call GC when AWT encounters an out of memory error

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 6
    • 1.4.2_17, 6
    • client-libs
    • b49
    • x86
    • windows, windows_xp

        In awt_new.cpp, AWT has a handler for memory allocation. When an allocation
        fails (either malloc or new), this handler is invoked. It tries to compact
        the heap by invoking the garbage collector, and if successful, tries the
        memory allocation again. This may have made sense in the days when we were
        using the Symantec JIT, but it doesn't anymore. In fact, it has caused
        problems for the VM team. They have asked that the handler be removed.

        Throwing an OutOfMemory Exception is fine, but invoking the garbage collector
        is not.

        The handler function is:

        // Called when malloc or operator new runs out of memory. We try to
        // compact the heap by initiating a Java GC. If the amount of free
        // memory available after this operation increases, then we return
        // (1) to indicate that malloc or operator new should retry the
        // allocation. Returning (0) indicates that the allocation should fail.
        int
        NewHandler::handler(size_t) {

              dmikhalksunw Denis Mikhalkin (Inactive)
              ehawkessunw Eric Hawkes (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: