From e0d500de864caa925f37f8e6b5a688269ca892bf Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Sat, 25 Apr 2015 16:10:50 -0400 Subject: [PATCH] avoid memory leak --- core/src/processing/data/StringList.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/processing/data/StringList.java b/core/src/processing/data/StringList.java index 65d73ceb9..3507545b6 100644 --- a/core/src/processing/data/StringList.java +++ b/core/src/processing/data/StringList.java @@ -150,8 +150,9 @@ public class StringList implements Iterable { if (count == 0) { throw new RuntimeException("Can't call pop() on an empty list"); } - String value = get(count-1); - count--; + count--; // back up to the last entry + String value = get(count); + data[count] = null; // avoid leak return value; }