Commit 20547a9f authored by Vitaliy.Bibaev's avatar Vitaliy.Bibaev
Browse files

[memory-agent] Do not estimate the retained size of too many objects (more than 2000)

parent 21b7e250
Branches unavailable Tags unavailable
No related merge requests found
Showing with 5 additions and 0 deletions
+5 -0
......@@ -36,6 +36,7 @@ import java.util.jar.Attributes;
public class MemoryAgentUtil {
private static final Logger LOG = Logger.getInstance(MemoryAgentUtil.class);
private static final int ESTIMATE_OBJECTS_SIZE_LIMIT = 2000;
public static void addMemoryAgent(@NotNull JavaParameters parameters) {
if (!DebuggerSettings.getInstance().ENABLE_MEMORY_AGENT) {
......@@ -83,6 +84,10 @@ public class MemoryAgentUtil {
public static List<JavaReferenceInfo> tryCalculateSizes(@NotNull List<JavaReferenceInfo> objects, @Nullable MemoryAgent agent) {
if (agent == null || !agent.canEvaluateObjectsSizes()) return objects;
if (objects.size() > ESTIMATE_OBJECTS_SIZE_LIMIT) {
LOG.info("Too many objects to estimate their sizess");
return objects;
}
try {
long[] sizes = agent.evaluateObjectsSizes(ContainerUtil.map(objects, x -> x.getObjectReference()));
return IntStreamEx.range(0, objects.size())
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment