reduce memory footprint: old generation by 100 MB
This reduces the size of the old generation by 100MB (300MB down to 200MB). Unfortunately the total JVM size didn't change and is still 512MB. Doc stores the path as byte array instead of Path.
This commit is contained in:
@@ -1,17 +1,21 @@
|
|||||||
package org.lucares.pdb.datastore;
|
package org.lucares.pdb.datastore;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
import org.lucares.pdb.api.Tags;
|
import org.lucares.pdb.api.Tags;
|
||||||
|
|
||||||
public class Doc {
|
public class Doc {
|
||||||
private final Tags tags;
|
private final Tags tags;
|
||||||
private final Path path;
|
private final byte[] path;
|
||||||
|
//private final Path path;
|
||||||
|
|
||||||
public Doc(final Tags tags, final Path path) {
|
public Doc(final Tags tags, final Path path) {
|
||||||
super();
|
super();
|
||||||
this.tags = tags;
|
this.tags = tags;
|
||||||
this.path = path;
|
this.path = path.toString().getBytes(StandardCharsets.UTF_8);
|
||||||
|
//this.path=path;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Tags getTags() {
|
public Tags getTags() {
|
||||||
@@ -19,12 +23,13 @@ public class Doc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Path getPath() {
|
public Path getPath() {
|
||||||
return path;
|
return Paths.get(new String(path, StandardCharsets.UTF_8));
|
||||||
|
//return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Doc [tags=" + tags + ", path=" + path + "]";
|
return "Doc [tags=" + tags + ", path=" + getPath() + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package org.lucares.memory;
|
package org.lucares.memory;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -30,7 +33,7 @@ public class MemoryScale {
|
|||||||
|
|
||||||
private static Object createObject(){
|
private static Object createObject(){
|
||||||
|
|
||||||
String key = "minimap";
|
String key = "pathAsUtf8";
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case "minimap":
|
case "minimap":
|
||||||
return createMinimap();
|
return createMinimap();
|
||||||
@@ -38,12 +41,31 @@ public class MemoryScale {
|
|||||||
return createString();
|
return createString();
|
||||||
case "linkedHashMap":
|
case "linkedHashMap":
|
||||||
return createLinkedHashMap();
|
return createLinkedHashMap();
|
||||||
|
case "path":
|
||||||
|
return createPath("C:\\pdb\\dataNew\\storage\\0\\4\\3n-5k_0-5l_2-1L_4-4n_3w-5h_6-7$.pdb");
|
||||||
|
case "pathAsString":
|
||||||
|
return createPathAsString("C:\\pdb\\dataNew\\storage\\0\\4\\3n-5k_0-5l_2-1L_4-4n_3w-5h_6-7$.pdb");
|
||||||
|
case "pathAsUtf8":
|
||||||
|
return createPathAsUtf8("C:\\pdb\\dataNew\\storage\\0\\4\\3n-5k_0-5l_2-1L_4-4n_3w-5h_6-7$.pdb");
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Object createPathAsUtf8(String string) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return string.getBytes(StandardCharsets.UTF_8);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String createPathAsString(String string) {
|
||||||
|
return string.replace("C", "c");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Path createPath(String string) {
|
||||||
|
return Paths.get(string);
|
||||||
|
}
|
||||||
|
|
||||||
private static Object createMinimap() {
|
private static Object createMinimap() {
|
||||||
final MiniMap<String, String> map = new MiniMap<>();
|
final MiniMap<String, String> map = new MiniMap<>();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user