Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8275301 Unify C-heap buffer overrun checks into NMT
  3. JDK-8277822

Remove debug-only heap overrun checks in os::malloc and friends



    • b07



        As a second step after integrating C heap overrun checks into NMT (JDK-8275320), we can now remove debug-only guarding memory for os::malloc() and friends. For the whole ratio, please refer to the umbrella JBS (JDK-8275301).

        This will:
        - reduce the complexity of os::malloc, os::realloc (especially this, realloc is tricky to get right) and os::free
        - reduce memory overhead in debug builds; depending on malloc granularity, this can be significant: a test program I have here which does
        - reduce CPU overhead. Not sure if its measurable, but we do less now.
        - make debug VMs behave much more similarly to release VMs in terms of memory layout of allocations, and make both variants travel more similar code paths. That improves testing coverage and makes it easier to reproduce errors with debug VMs (same memory layout).

        Currently, we have always-on heap overrun checks in debug VMs. In order to get this after the patch, NMT should be switched on always in debug. NMT level summary is *very* cheap. Memory overhead will probably be less than what we paid before with the quite generous debug-only guards. NMT accounting is minimal and, again, should not be worse than what we did before - adjusting some global counters, in case of NMT per NMT category.

        Finally, this would also be a good coverage test for NMT.


          Issue Links



                stuefe Thomas Stuefe
                stuefe Thomas Stuefe
                0 Vote for this issue
                5 Start watching this issue