Changeset 17439 in josm


Ignore:
Timestamp:
2021-01-04T16:51:24+01:00 (2 months ago)
Author:
GerdP
Message:

see #17184: Memory leaks

  • implement method clear() in GpxData and call it when the GpxLayer is destroyed

Reduces memory leak when GPX layers are merged. Without this change GC seems to be unable to free the memory for WayPoints

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java

    r16953 r17439  
    12741274        }
    12751275    }
     1276
     1277    /**
     1278     * Removes all gpx elements
     1279     * @since 17439
     1280     */
     1281    public void clear() {
     1282        dataSources.clear();
     1283        layerPrefs.clear();
     1284        privateRoutes.clear();
     1285        privateTracks.clear();
     1286        privateWaypoints.clear();
     1287        attr.clear();
     1288    }
    12761289}
  • trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java

    r16967 r17439  
    618618        }
    619619    }
     620
     621    @Override
     622    public synchronized void destroy() {
     623        data.clear();
     624        data = null;
     625        super.destroy();
     626    }
    620627}
Note: See TracChangeset for help on using the changeset viewer.