[foreign-memaccess] RFR: 8252770: MemorySegment::allocateNative should honor direct memory limits [v2]

Maurizio Cimadamore mcimadamore at openjdk.java.net
Fri Sep 4 09:46:22 UTC 2020


> Currently, `MemorySegment::allocateNative` does not honor the memory limits set for direct buffers
> (`-XX:MaxDirectMemorySize` and `-XX:+PageAlignDirectMemory`).This patch rectifies that. The changes are pretty simple,
> the main issue was that most of the methods are defined away in the `Bits` class which belongs to the nio package, so
> the usual access dance was necessary.  Since segments can already be allocated with an alignment, I slightly tweaked
> the alignment logic to compute the max between page size and requested alignment, in case the option for aligning
> direct memory chunks to page boundaries is set.   Tweak NativeMemorySegmentImpl to respect direct memory settings

Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:

  Renamed MAX_ALIGN to MAX_MALLOC_ALIGN

-------------

Changes:
  - all: https://git.openjdk.java.net/panama-foreign/pull/306/files
  - new: https://git.openjdk.java.net/panama-foreign/pull/306/files/015ee748..11b75e3c

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=panama-foreign&pr=306&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=panama-foreign&pr=306&range=00-01

  Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod
  Patch: https://git.openjdk.java.net/panama-foreign/pull/306.diff
  Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/306/head:pull/306

PR: https://git.openjdk.java.net/panama-foreign/pull/306


More information about the panama-dev mailing list