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

"memory stomping error" when running java/foreign/TestNative.java on a debug build

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: repo-panama
    • Fix Version/s: None
    • Component/s: tools

      Description

      The test TestNative.java uses malloc to allocate memory, and then uses Unsafe::freeMemory to free it again.

      But, Unsafe allocation, which calls into os::malloc, inserts guards before and after the allocated block when running on a debug build (to check for OOB access). These guards are then verified when freeing the memory, which is where the problem occurs; since the memory in the test was allocated with malloc, there are no such guards and the verification fails.

      We can fix this by creating a native binding for the free() function, and using that instead of Unsafe::freeMemory.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jvernee Jorn Vernee
              Reporter:
              jvernee Jorn Vernee
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: