|
Re: memory profiling question [message #40341 is a reply to message #40145] |
Mon, 14 November 2005 18:41 |
No real name Messages: 404 Registered: July 2009 |
Senior Member |
|
|
The objects will always remain in the memory statistics view but the
counters reported for the "live instances" and "collected" columns should
change accordingly. Attached is a sample program to verify this.
You can add "-verbose:gc" as a VM argument in the Arguments tab of the
profile launch configuration item to see when garbage collection kicks in.
I have also noticed that items don't get garbage collected (or at least we
don't get object free events reported) when the container for the destroyed
objects is not set to null. If you take out line 26 of the class that I
have attached, then you will not see any instances of MemoryClass being
collected.
If you have a sample program that you're testing this out with, then please
attach it to this thread.
One last thing that you may want to verify is that you have checked the
"collect instance level information" for the "Memory analysis" profiling
set. To check this option, follow the steps below:
Select the profile launch configuration item > Select the "Profiling" tab >
Click the "Memory Analysis" profiling set > Click "Edit..." > Click Next >
Select "Basic Memory Analysis" on the left > Click on "Advanced>>" > Check
the option "Collect instance level information" > Click on "Finish"
"Evert-Jan Blom" <e.j.blom@rug.nl> wrote in message
news:dl5f6n$hu8$1@news.eclipse.org...
> Dear group,
>
> I have a question concerning the memory profiling option of TPTP.
> When I create objects in my application, the profiler notices this and
shows
> the number of objects
> in the memory statisticcs pane. So far so good, but when the objects are
> removed,
> they are still listed in the pane. Even when I press refresh view, run the
> garbage collector manually.
> I know the objects are gone, if I pause monitoring and start it after
> deleting the objects, I
> can't see any of the objects in the statistics.
>
> Any thoughts on this?
>
> Regards
>
> EJ Blom
>
>
|
|
|
Re: memory profiling question [message #40433 is a reply to message #40341] |
Tue, 15 November 2005 01:46 |
No real name Messages: 404 Registered: July 2009 |
Senior Member |
|
|
Here's the class file:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Vector;
public class MemoryClass {
private static Vector container = new Vector();
private static final int CONTAINER_SIZE = 100;
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException
{
createObjects();
System.out.println(CONTAINER_SIZE + " objects created");
BufferedReader br = new BufferedReader (new InputStreamReader
(System.in));
System.out.println("Press any key for objects to be destroyed");
br.readLine();
destroyObjects();
container=null;
System.gc();
System.out.println("Press any key to quit");
br.readLine();
}
private static void destroyObjects() {
for (int i = container.size() - 1; i <= 0; i--)
{
container.remove(i);
}
}
private static void createObjects() {
for (int i = 0; i < CONTAINER_SIZE; i++)
{
container.add(new MemoryClass());
}
}
}
"Ali Mehregani" <amehrega@ca.ibm.com> wrote in message
news:dlaljh$3c8$1@news.eclipse.org...
> The objects will always remain in the memory statistics view but the
> counters reported for the "live instances" and "collected" columns should
> change accordingly. Attached is a sample program to verify this.
>
> You can add "-verbose:gc" as a VM argument in the Arguments tab of the
> profile launch configuration item to see when garbage collection kicks in.
> I have also noticed that items don't get garbage collected (or at least we
> don't get object free events reported) when the container for the
destroyed
> objects is not set to null. If you take out line 26 of the class that I
> have attached, then you will not see any instances of MemoryClass being
> collected.
>
> If you have a sample program that you're testing this out with, then
please
> attach it to this thread.
>
> One last thing that you may want to verify is that you have checked the
> "collect instance level information" for the "Memory analysis" profiling
> set. To check this option, follow the steps below:
>
> Select the profile launch configuration item > Select the "Profiling" tab
>
> Click the "Memory Analysis" profiling set > Click "Edit..." > Click Next >
> Select "Basic Memory Analysis" on the left > Click on "Advanced>>" > Check
> the option "Collect instance level information" > Click on "Finish"
>
> "Evert-Jan Blom" <e.j.blom@rug.nl> wrote in message
> news:dl5f6n$hu8$1@news.eclipse.org...
> > Dear group,
> >
> > I have a question concerning the memory profiling option of TPTP.
> > When I create objects in my application, the profiler notices this and
> shows
> > the number of objects
> > in the memory statisticcs pane. So far so good, but when the objects are
> > removed,
> > they are still listed in the pane. Even when I press refresh view, run
the
> > garbage collector manually.
> > I know the objects are gone, if I pause monitoring and start it after
> > deleting the objects, I
> > can't see any of the objects in the statistics.
> >
> > Any thoughts on this?
> >
> > Regards
> >
> > EJ Blom
> >
> >
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.02124 seconds