memory leak
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
package com.instana.robotshop.shipping;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -23,7 +23,7 @@ public class Controller {
|
||||
|
||||
private String CART_URL = String.format("http://%s/shipping/", getenv("CART_ENDPOINT", "cart"));
|
||||
|
||||
public static ArrayList bytesGlobal = new ArrayList<byte[]>();
|
||||
public static List bytesGlobal = Collections.synchronizedList(new ArrayList<byte[]>());
|
||||
|
||||
@Autowired
|
||||
private CityRepository cityrepo;
|
||||
@@ -43,6 +43,14 @@ public class Controller {
|
||||
byte[] bytes = new byte[1024 * 1024 * 25];
|
||||
Arrays.fill(bytes,(byte)8);
|
||||
bytesGlobal.add(bytes);
|
||||
|
||||
return bytesGlobal.size();
|
||||
}
|
||||
|
||||
@GetMapping(path = "/free")
|
||||
public int free() {
|
||||
bytesGlobal.clear();
|
||||
|
||||
return bytesGlobal.size();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user