8344882: (bf) Temporary direct buffers should not count against the upper limit on direct buffer memory

Reviewed-by: alanb
This commit is contained in:
Brian Burkhalter 2024-11-27 16:14:03 +00:00
parent 75f3ec77e4
commit 0312694c46
5 changed files with 38 additions and 11 deletions

View file

@ -847,6 +847,11 @@ public abstract sealed class Buffer
return new HeapByteBuffer(hb, -1, 0, capacity, capacity, offset, segment);
}
@Override
public ByteBuffer newDirectByteBuffer(long addr, int cap) {
return new DirectByteBuffer(addr, cap);
}
@ForceInline
@Override
public Object getBufferBase(Buffer buffer) {

View file

@ -159,9 +159,10 @@ class Direct$Type$Buffer$RW$$BO$
}
// Invoked only by JNI: NewDirectByteBuffer(void*, long)
// and JavaNioAccess.newDirectByteBuffer(int).
// The long-valued capacity is restricted to int range.
//
private Direct$Type$Buffer(long addr, long cap) {
Direct$Type$Buffer(long addr, long cap) {
super(-1, 0, checkCapacity(cap), (int)cap, null);
address = addr;
cleaner = null;