This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 251064 - Profiler agent object creation adds noise to memory sampling results
Summary: Profiler agent object creation adds noise to memory sampling results
Status: RESOLVED FIXED
Alias: None
Product: profiler
Classification: Unclassified
Component: Engine (show other bugs)
Version: 8.1
Hardware: All All
: P3 normal (vote)
Assignee: Tomas Hurka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-10 12:28 UTC by Jiri Sedlacek
Modified: 2015-03-12 04:27 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Sedlacek 2015-03-10 12:28:29 UTC
From the related bugdb:

"Testcase Details / Step-By-Step Instructions:
---------------------------------------------
1) Create the following class:
package client;

public class Class1 {
    public static void main(String[] args) {
        for (;;) {
            new Class1();
        }
    }
}
2) Run it
3) Connect the profiler

Observe that there are lots of objects being created: char[], byte[], int[],
HeapCharBuffer and String. Clearly these aren't due to the above class which
should only be creating Class1 objects. Investigating this I believe the
HeapCharBuffers are coming from the following code:

Source breakpoint: HeapCharBuffer.java:86
  at java.nio.HeapCharBuffer.<init>(HeapCharBuffer.java:86)
  at java.nio.HeapCharBuffer.subSequence(HeapCharBuffer.java:576)
  at java.nio.HeapCharBuffer.subSequence(HeapCharBuffer.java:42)
  at java.util.regex.Matcher.getSubSequence(Matcher.java:1245)
  at java.util.regex.Matcher.group(Matcher.java:490)
  at java.util.regex.Matcher.group(Matcher.java:445)
  at java.util.Scanner.getCompleteTokenInBuffer(Scanner.java:1009)
  at java.util.Scanner.next(Scanner.java:1407)
  at
org.netbeans.lib.profiler.server.HeapHistogramManager$ClassInfoImpl.<init>(HeapHistogramManager.java:268)
  at
org.netbeans.lib.profiler.server.HeapHistogramManager.computeHistogramImpl(HeapHistogramManager.java:181)
  at
org.netbeans.lib.profiler.server.HeapHistogramManager.computeHistogram(HeapHistogramManager.java:119)
  at
org.netbeans.lib.profiler.server.ProfilerInterface.computeHistogram(ProfilerInterface.java:690)
  at
org.netbeans.lib.profiler.server.ProfilerServer.handleClientCommand(ProfilerServer.java:1665)
  at
org.netbeans.lib.profiler.server.ProfilerServer.listenToClient(ProfilerServer.
java:1740)
  at
org.netbeans.lib.profiler.server.ProfilerServer.run(ProfilerServer.java:691)

I'm assuming other objects are similarly being created.

This is clearly completely changing the behaviour of the application, which
makes the monitoring data fairly useless."
Comment 1 Tomas Hurka 2015-03-10 13:51:06 UTC
Fixed in profiler-main

changeset:   284534:45a913501a81
user:        Tomas Hurka <thurka@netbeans.org>
date:        Tue Mar 10 14:49:42 2015 +0100
summary:     bugfix #251064, use custom Scanner class to lower the number of created objects when parsing the output of Histogram.getRawHistogram()
Comment 2 Quality Engineering 2015-03-12 04:27:41 UTC
Integrated into 'main-silver', will be available in build *201503120001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/45a913501a81
User: Tomas Hurka <thurka@netbeans.org>
Log: bugfix #251064, use custom Scanner class to lower the number of created objects when parsing the output of Histogram.getRawHistogram()