mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-14 06:16:46 +01:00
Fix accumulation of weak reference keys (mem leak) in snapshot cache
This commit is contained in:
parent
bd92cc37bf
commit
babc8cd073
@ -1076,6 +1076,10 @@ public class MapManager {
|
|||||||
|
|
||||||
if(saverestorepending)
|
if(saverestorepending)
|
||||||
savePending();
|
savePending();
|
||||||
|
if(sscache != null) {
|
||||||
|
sscache.cleanup();
|
||||||
|
sscache = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private HashMap<World, File> worldTileDirectories = new HashMap<World, File>();
|
private HashMap<World, File> worldTileDirectories = new HashMap<World, File>();
|
||||||
|
@ -122,8 +122,10 @@ public class SnapshotCache {
|
|||||||
private void processRefQueue() {
|
private void processRefQueue() {
|
||||||
Reference<? extends ChunkSnapshot> ref;
|
Reference<? extends ChunkSnapshot> ref;
|
||||||
while((ref = refqueue.poll()) != null) {
|
while((ref = refqueue.poll()) != null) {
|
||||||
String k = snapcache.reverselookup.get(ref);
|
String k = snapcache.reverselookup.remove(ref);
|
||||||
if(k != null) snapcache.remove(k);
|
if(k != null) {
|
||||||
|
snapcache.remove(k);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -141,5 +143,16 @@ public class SnapshotCache {
|
|||||||
public void resetStats() {
|
public void resetStats() {
|
||||||
cache_attempts = cache_success = 0;
|
cache_attempts = cache_success = 0;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Cleanup
|
||||||
|
*/
|
||||||
|
public void cleanup() {
|
||||||
|
if(snapcache != null) {
|
||||||
|
snapcache.clear();
|
||||||
|
snapcache.reverselookup.clear();
|
||||||
|
snapcache.reverselookup = null;
|
||||||
|
snapcache = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user