mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8129776: The optimized Stream returned from Files.lines should unmap the mapped byte buffer (if created) when closed
Reviewed-by: rriggs, psandoz, alanb
This commit is contained in:
parent
ad525bcd38
commit
7451962849
3 changed files with 50 additions and 18 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -32,6 +32,7 @@ import java.util.Objects;
|
|||
import jdk.internal.access.foreign.MemorySegmentProxy;
|
||||
import jdk.internal.access.foreign.UnmapperProxy;
|
||||
import jdk.internal.misc.ScopedMemoryAccess;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -132,7 +133,7 @@ public abstract class MappedByteBuffer
|
|||
|
||||
@Override
|
||||
public void unmap() {
|
||||
throw new UnsupportedOperationException();
|
||||
Unsafe.getUnsafe().invokeCleaner(MappedByteBuffer.this);
|
||||
}
|
||||
} : null;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue