aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/files
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2013-02-14 22:20:16 +0100
committerBananeweizen <bananeweizen@gmx.de>2013-02-14 22:20:16 +0100
commit7106273249ed67a1e95ce8e5c1acf49b583ce190 (patch)
tree6d8c5cf3a8861cbed071b0527f2ef473c541d8db /main/src/cgeo/geocaching/files
parentdaadd2fee87366d475f0936b838c72bf0f9be2b0 (diff)
downloadcgeo-7106273249ed67a1e95ce8e5c1acf49b583ce190.zip
cgeo-7106273249ed67a1e95ce8e5c1acf49b583ce190.tar.gz
cgeo-7106273249ed67a1e95ce8e5c1acf49b583ce190.tar.bz2
reduce memory usage for cache lists
* lazily load some of the strings in caches * remove latlon, it was never used except in parsing itself * change some collection handling to avoid huge memory hogs
Diffstat (limited to 'main/src/cgeo/geocaching/files')
-rw-r--r--main/src/cgeo/geocaching/files/GPXParser.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/main/src/cgeo/geocaching/files/GPXParser.java b/main/src/cgeo/geocaching/files/GPXParser.java
index a691677..5647d14 100644
--- a/main/src/cgeo/geocaching/files/GPXParser.java
+++ b/main/src/cgeo/geocaching/files/GPXParser.java
@@ -331,7 +331,7 @@ public abstract class GPXParser extends FileParser {
// lookup cache for waypoint in already parsed caches
final Geocache cacheForWaypoint = cgData.loadCache(cacheGeocodeForWaypoint, LoadFlags.LOAD_CACHE_OR_DB);
if (cacheForWaypoint != null) {
- final Waypoint waypoint = new Waypoint(cache.getShortdesc(), convertWaypointSym2Type(sym), false);
+ final Waypoint waypoint = new Waypoint(cache.getShortDescription(), convertWaypointSym2Type(sym), false);
waypoint.setId(-1);
waypoint.setGeocode(cacheGeocodeForWaypoint);
waypoint.setPrefix(cache.getName().substring(0, 2));
@@ -388,7 +388,7 @@ public abstract class GPXParser extends FileParser {
public void end(String body) {
desc = body;
- cache.setShortdesc(validate(body));
+ cache.setShortDescription(validate(body));
}
});
@@ -638,7 +638,7 @@ public abstract class GPXParser extends FileParser {
@Override
public void end(String shortDesc) {
- cache.setShortdesc(validate(shortDesc));
+ cache.setShortDescription(validate(shortDesc));
}
});
@@ -859,6 +859,13 @@ public abstract class GPXParser extends FileParser {
cmt = null;
cache = new Geocache(this);
+
+ // explicitly set all properties which could lead to database access, if left as null value
+ cache.setLocation("");
+ cache.setDescription("");
+ cache.setShortDescription("");
+ cache.setHint("");
+
for (int i = 0; i < userData.length; i++) {
userData[i] = null;
}