From 322c224a75755c619837f80e290a0b45f5d0168d Mon Sep 17 00:00:00 2001 From: Sunjeet Singh Date: Thu, 3 Aug 2023 08:23:21 -0700 Subject: [PATCH] Bugfix: destoy delta encodedAdditions after its safe to do so --- .../hollow/core/read/engine/list/HollowListDeltaApplicator.java | 1 - .../hollow/core/read/engine/list/HollowListTypeReadState.java | 1 + .../hollow/core/read/engine/map/HollowMapDeltaApplicator.java | 1 - .../hollow/core/read/engine/map/HollowMapTypeReadState.java | 1 + .../core/read/engine/object/HollowObjectDeltaApplicator.java | 1 - .../core/read/engine/object/HollowObjectTypeReadState.java | 1 + .../hollow/core/read/engine/set/HollowSetDeltaApplicator.java | 1 - .../hollow/core/read/engine/set/HollowSetTypeReadState.java | 1 + 8 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hollow/src/main/java/com/netflix/hollow/core/read/engine/list/HollowListDeltaApplicator.java b/hollow/src/main/java/com/netflix/hollow/core/read/engine/list/HollowListDeltaApplicator.java index 1f296790f5..c7852509f0 100644 --- a/hollow/src/main/java/com/netflix/hollow/core/read/engine/list/HollowListDeltaApplicator.java +++ b/hollow/src/main/java/com/netflix/hollow/core/read/engine/list/HollowListDeltaApplicator.java @@ -72,7 +72,6 @@ public void applyDelta() { from.encodedRemovals = null; removalsReader.destroy(); - additionsReader.destroy(); } private void slowDelta() { diff --git a/hollow/src/main/java/com/netflix/hollow/core/read/engine/list/HollowListTypeReadState.java b/hollow/src/main/java/com/netflix/hollow/core/read/engine/list/HollowListTypeReadState.java index df6ec21470..72b262eede 100644 --- a/hollow/src/main/java/com/netflix/hollow/core/read/engine/list/HollowListTypeReadState.java +++ b/hollow/src/main/java/com/netflix/hollow/core/read/engine/list/HollowListTypeReadState.java @@ -123,6 +123,7 @@ public void applyDelta(HollowBlobInput in, HollowSchema schema, ArraySegmentRecy nextData.applyDelta(oldData, deltaData); shards[i].setCurrentData(nextData); notifyListenerAboutDeltaChanges(deltaData.encodedRemovals, deltaData.encodedAdditions, i, shards.length); + deltaData.encodedAdditions.destroy(); oldData.destroy(); } deltaData.destroy(); diff --git a/hollow/src/main/java/com/netflix/hollow/core/read/engine/map/HollowMapDeltaApplicator.java b/hollow/src/main/java/com/netflix/hollow/core/read/engine/map/HollowMapDeltaApplicator.java index fe66a42c33..1994926a91 100644 --- a/hollow/src/main/java/com/netflix/hollow/core/read/engine/map/HollowMapDeltaApplicator.java +++ b/hollow/src/main/java/com/netflix/hollow/core/read/engine/map/HollowMapDeltaApplicator.java @@ -81,7 +81,6 @@ public void applyDelta() { from.encodedRemovals = null; removalsReader.destroy(); - additionsReader.destroy(); } private void slowDelta() { diff --git a/hollow/src/main/java/com/netflix/hollow/core/read/engine/map/HollowMapTypeReadState.java b/hollow/src/main/java/com/netflix/hollow/core/read/engine/map/HollowMapTypeReadState.java index ba2d524cd8..87abc7e1a6 100644 --- a/hollow/src/main/java/com/netflix/hollow/core/read/engine/map/HollowMapTypeReadState.java +++ b/hollow/src/main/java/com/netflix/hollow/core/read/engine/map/HollowMapTypeReadState.java @@ -130,6 +130,7 @@ public void applyDelta(HollowBlobInput in, HollowSchema schema, ArraySegmentRecy nextData.applyDelta(oldData, deltaData); shards[i].setCurrentData(nextData); notifyListenerAboutDeltaChanges(deltaData.encodedRemovals, deltaData.encodedAdditions, i, shards.length); + deltaData.encodedAdditions.destroy(); oldData.destroy(); } deltaData.destroy(); diff --git a/hollow/src/main/java/com/netflix/hollow/core/read/engine/object/HollowObjectDeltaApplicator.java b/hollow/src/main/java/com/netflix/hollow/core/read/engine/object/HollowObjectDeltaApplicator.java index 960e1b1c25..ddea125b34 100644 --- a/hollow/src/main/java/com/netflix/hollow/core/read/engine/object/HollowObjectDeltaApplicator.java +++ b/hollow/src/main/java/com/netflix/hollow/core/read/engine/object/HollowObjectDeltaApplicator.java @@ -98,7 +98,6 @@ void applyDelta() { from.encodedRemovals = null; removalsReader.destroy(); - additionsReader.destroy(); } private boolean canDoFastDelta() { diff --git a/hollow/src/main/java/com/netflix/hollow/core/read/engine/object/HollowObjectTypeReadState.java b/hollow/src/main/java/com/netflix/hollow/core/read/engine/object/HollowObjectTypeReadState.java index aaf5f6cf34..ed8379e0e6 100644 --- a/hollow/src/main/java/com/netflix/hollow/core/read/engine/object/HollowObjectTypeReadState.java +++ b/hollow/src/main/java/com/netflix/hollow/core/read/engine/object/HollowObjectTypeReadState.java @@ -131,6 +131,7 @@ public void applyDelta(HollowBlobInput in, HollowSchema deltaSchema, ArraySegmen nextData.applyDelta(oldData, deltaData); shards[i].setCurrentData(nextData); notifyListenerAboutDeltaChanges(deltaData.encodedRemovals, deltaData.encodedAdditions, i, shards.length); + deltaData.encodedAdditions.destroy(); oldData.destroy(); } deltaData.destroy(); diff --git a/hollow/src/main/java/com/netflix/hollow/core/read/engine/set/HollowSetDeltaApplicator.java b/hollow/src/main/java/com/netflix/hollow/core/read/engine/set/HollowSetDeltaApplicator.java index 1212706dda..3ac436999f 100644 --- a/hollow/src/main/java/com/netflix/hollow/core/read/engine/set/HollowSetDeltaApplicator.java +++ b/hollow/src/main/java/com/netflix/hollow/core/read/engine/set/HollowSetDeltaApplicator.java @@ -78,7 +78,6 @@ public void applyDelta() { from.encodedRemovals = null; removalsReader.destroy(); - additionsReader.destroy(); } diff --git a/hollow/src/main/java/com/netflix/hollow/core/read/engine/set/HollowSetTypeReadState.java b/hollow/src/main/java/com/netflix/hollow/core/read/engine/set/HollowSetTypeReadState.java index 5860bede57..b18d5eb3f0 100644 --- a/hollow/src/main/java/com/netflix/hollow/core/read/engine/set/HollowSetTypeReadState.java +++ b/hollow/src/main/java/com/netflix/hollow/core/read/engine/set/HollowSetTypeReadState.java @@ -131,6 +131,7 @@ public void applyDelta(HollowBlobInput in, HollowSchema schema, ArraySegmentRecy nextData.applyDelta(oldData, deltaData); shards[i].setCurrentData(nextData); notifyListenerAboutDeltaChanges(deltaData.encodedRemovals, deltaData.encodedAdditions, i, shards.length); + deltaData.encodedAdditions.destroy(); oldData.destroy(); } deltaData.destroy();