This is an automated email from the ASF dual-hosted git repository.

rvesse pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/jena.git

commit 922af08ceb34048a6464e80270806feee04efb74
Author: Andy Seaborne <[email protected]>
AuthorDate: Wed Jun 4 18:40:46 2025 +0100

    GH-3240: Explicit after releasing handled to MappedByteBuffer objects
---
 .../src/main/java/org/apache/jena/tdb2/sys/StoreConnection.java  | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git 
a/jena-tdb2/src/main/java/org/apache/jena/tdb2/sys/StoreConnection.java 
b/jena-tdb2/src/main/java/org/apache/jena/tdb2/sys/StoreConnection.java
index 89ff6053cf..98b2839900 100644
--- a/jena-tdb2/src/main/java/org/apache/jena/tdb2/sys/StoreConnection.java
+++ b/jena-tdb2/src/main/java/org/apache/jena/tdb2/sys/StoreConnection.java
@@ -148,6 +148,15 @@ public class StoreConnection
             sConn.lock.unlock();
             ProcessFileLock.release(sConn.lock);
         }
+        // https://bugs.openjdk.org/browse/JDK-4724038
+        //   Release of memory mapped files.
+        //
+        // This can help with memory mapped buffers but this is not a 
guarantee.
+        // TDB2 does not hand out the MappedByBuffer the reference and
+        // closing nulls the references. The GC usually causes the clearup.
+        //
+        // This does not fix the MS-Windows specific issue.
+        Runtime.getRuntime().gc();
     }
 
     /** Create or fetch a {@link ProcessFileLock} for a Location */

Reply via email to