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

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


On Thu, 3 Sep 2020 14:18:18 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> 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

This pull request has now been integrated.

Changeset: 2c1e564d
Author:    Maurizio Cimadamore <mcimadamore at openjdk.org>
URL:       https://git.openjdk.java.net/panama-foreign/commit/2c1e564d
Stats:     54 lines in 7 files changed: 6 ins; 39 del; 9 mod

8252770: MemorySegment::allocateNative should honor direct memory limits

Reviewed-by: psandoz

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

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


More information about the panama-dev mailing list