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

Use custom malloc to expose pointer tagged data to NMT.

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • None
    • hotspot

      We have asked Florian Weimer from RedHat whether malloc could allow clients to access the internal free bits of pointer data, but were told that glibc would rather find a way to give that data back to the application.

      Florian suggested to use a custom malloc.

      We could take the vanilla glibc malloc and extend it by exposing the internal pointer metadata, which mallloc will always require to store the pointer size, so that "free()" API works.

      Having such mechanism built into the malloc would allow NMT to:

      - remove its own mechanism for pointer data tagging
      - remove NMT pre-init cache
      - be able to turn NMT ON/OFF during runtime
      - minimize the memory overhead associated with every pointer

      Another advantage would be the same behavior/patterns when allocating memory on all platforms (could be a disadvantage assuming that platform specific mallocs are platform optimized - but this deserves to be checked and compared with data based analysis, not assumptions)

      I think it deserves serious consideration and at least a prototype.

            gziemski Gerard Ziemski
            gziemski Gerard Ziemski
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: