From bb9a6032a3a2b88da0403c4607536cd9fa5c36d5 Mon Sep 17 00:00:00 2001 From: Zhang Lei Date: Tue, 14 Jan 2025 11:21:09 +0800 Subject: [PATCH] fix(analytical): Fix the garbage collection of GAE Java (#4001) As titled. --- .../parallel/mm/impl/GiraphMpiMessageManager.java | 7 ++++++- .../serialization/FFIByteVectorOutputStream.java | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/analytical_engine/java/grape-giraph/src/main/java/com/alibaba/graphscope/parallel/mm/impl/GiraphMpiMessageManager.java b/analytical_engine/java/grape-giraph/src/main/java/com/alibaba/graphscope/parallel/mm/impl/GiraphMpiMessageManager.java index cb5fbd0476e1..77989e3e9861 100644 --- a/analytical_engine/java/grape-giraph/src/main/java/com/alibaba/graphscope/parallel/mm/impl/GiraphMpiMessageManager.java +++ b/analytical_engine/java/grape-giraph/src/main/java/com/alibaba/graphscope/parallel/mm/impl/GiraphMpiMessageManager.java @@ -113,6 +113,7 @@ public void receiveMessages() { /////////////////////////////////////////// bytesOfReceivedMsg += tmpVector.size(); } + tmpVector.delete(); logger.info( "Frag [{}] totally Received [{}] bytes from others starting deserialization", fragId, @@ -256,5 +257,9 @@ public void postSuperstep() { } @Override - public void postApplication() {} + public void postApplication() { + for (int i = 0; i < fragNum; ++i) { + cacheOut[i].close(); + } + } } diff --git a/analytical_engine/java/grape-jdk/src/main/java/com/alibaba/graphscope/serialization/FFIByteVectorOutputStream.java b/analytical_engine/java/grape-jdk/src/main/java/com/alibaba/graphscope/serialization/FFIByteVectorOutputStream.java index 543f32db60da..ace7cdee8208 100644 --- a/analytical_engine/java/grape-jdk/src/main/java/com/alibaba/graphscope/serialization/FFIByteVectorOutputStream.java +++ b/analytical_engine/java/grape-jdk/src/main/java/com/alibaba/graphscope/serialization/FFIByteVectorOutputStream.java @@ -38,6 +38,11 @@ public FFIByteVectorOutputStream(FFIByteVector vector) { offset = 0; } + @Override + public void close() { + vector.delete(); + } + public void resize(long size) { vector.resize(size); }