diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2011-10-17 21:54:22 +0200 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2011-10-17 21:54:22 +0200 |
| commit | 8fb166da436f49154f0c9738e26f993b7772c68f (patch) | |
| tree | c56a3d90e5a612bee045bc748f71f169be69965c /main/src | |
| parent | 41e01ff3b9648960f81b67f1c70403be3e87b4df (diff) | |
| download | cgeo-8fb166da436f49154f0c9738e26f993b7772c68f.zip cgeo-8fb166da436f49154f0c9738e26f993b7772c68f.tar.gz cgeo-8fb166da436f49154f0c9738e26f993b7772c68f.tar.bz2 | |
fix: huge memory leak when searching caches, #679
* needs to be refactored further, this is only a short term fix
Diffstat (limited to 'main/src')
| -rw-r--r-- | main/src/cgeo/geocaching/cgBase.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/main/src/cgeo/geocaching/cgBase.java b/main/src/cgeo/geocaching/cgBase.java index e0b4281..15382ca 100644 --- a/main/src/cgeo/geocaching/cgBase.java +++ b/main/src/cgeo/geocaching/cgBase.java @@ -685,7 +685,10 @@ public class cgBase { final Matcher matcherCode = patternCode.matcher(row); while (matcherCode.find()) { if (matcherCode.groupCount() > 0) { - cache.geocode = matcherCode.group(1).toUpperCase(); + // The String constructor is necessary as long as the pattern matching doesn't use the + // methods from BaseUtil. Otherwise every geocode holds the complete page in memory + // FIXME: Use BaseUtil for parsing + cache.geocode = new String(matcherCode.group(1).toUpperCase().trim()); } } } catch (Exception e) { @@ -1609,7 +1612,8 @@ public class cgBase { if (matcher.find()) { - Settings.setGcCustomDate(matcher.group(1)); + // FIXME: Use BaseUtils for pattern matching to avoid huge Strings + Settings.setGcCustomDate(new String(matcher.group(1).trim())); } } |
