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

BufferBlob leaks

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 6
    • 1.4.2
    • hotspot
    • b75
    • generic
    • generic

      To generate code for most types of the generated code (e.g. nmethod,
      RuntimeStub, C2IAdapter, I2CAdapter, etc), a BufferBlob is created
      first, code is generated in the BufferBlob, then a final CodeBlob of
      the correct type is created and the generated code is copied over from the BufferBlob to the final CodeBlob. After that the BufferBlob should be freed. But some of the the temporary BufferBlobs created to help generating nmethods, RuntimeStubs, C2IAdapters and I2CAdapters are not freed afterwards. This is actually a leak in the CodeCache.

      1. In file ciEnv.cpp:

      a. In ciEnv::register_method():

      A call "code_buffer->free_auto_blob()" is needed before the return in the if (bailed_out()) block.

      b. In ciEnv::register_i2c_adapter():

      A call "code_buffer->free_auto_blob()" is needed both before the return in the if (bailed_out()) block and after the call to I2CAdapter::new_i2c_adapter().

      c. In ciEnv::register_c2i_adapter():

      A call "code_buffer->free_auto_blob()" is needed both before the return in the if (bailed_out()) block and after the call to C2IAdapter::new_i2c_adapter().

      2. In file compile.cpp:

      In the Compile class constructor for compiling a runtime stub, a call "_code_buffer->free_auto_blob()" is needed after the call to RuntimeStub::new_runtime_stub().

      2006-01-20 16:12:27.646 ###@###.###
       

      An update from HP:

      In general, this is a problem in all versions: 1.4.2, 5.0 and 6.0, although
      the details about where fixes are needed might be different since code has
      been changed between versions.

      Also, instead of the suggestions I made in my bug report, I'd like to make
      another suggestion of what I think is a better solution. That is, remove the
      "code_buffer->free_auto_blob()" calls that were already in ciEnv.cpp.
      Instead, make a destructor for Compile class, and calls "delete
      _code_buffer" from Compile class's destructor. This way, with one delete,
      temporary BufferBlobs created for all cases (nmethod, stubs, i2c adapter,
      c2i adapter) will be freed.

            never Tom Rodriguez
            ksoshals Kirill Soshalskiy (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: