[jboss-dev] testing memory leaks

Kabir Khan kabir.khan at jboss.com
Wed Nov 4 09:06:23 EST 2009


Take a look at https://svn.jboss.org/repos/jbossas/projects/aop/trunk/aop/src/test/java/org/jboss/test/aop/memoryleaks/MemoryLeakTester.java 
  or MemoryLeakTestCase.java to see it in use
On 4 Nov 2009, at 13:55, Kabir Khan wrote:

> JBoss Profiler has something there to force memory leaks for you via
> jmti.
>
> On 4 Nov 2009, at 13:49, Jason T. Greene wrote:
>
>> Jonathan Halliday wrote:
>>> Hi all
>>>
>>> I'm looking for a way to force garbage collection to run, as
>>> I need it in order to write meaningful memory leak tests.
>>>
>>> As far as I can tell, there is no way for force gc from
>>> inside the jvm, short of hacks like allocating all the
>>> remaining free memory.
>>>
>>> The best I can come up with so far is a bit of native code
>>> to call gc via the jvmti. This is a pain, as it means
>>> compiling for every test platform.
>>
>> We have a classloader leak test in the AS that does both of the  
>> above.
>> The former caused all kinds of hudson issues, usually because the JVM
>> gets into strange states/dealys when you repeatedly fill all heap
>> space.
>>
>> The latter however works very reliably. The solution to the
>> portability
>> problem is IMO, to separate the leak testing from the main testsuite,
>> and then run that on a dedicated platform. If you have a real Java
>> memory leak, it should show up on every OS, but probably not every
>> JVM.
>>
>> -- 
>> Jason T. Greene
>> JBoss, a division of Red Hat
>> _______________________________________________
>> jboss-development mailing list
>> jboss-development at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/jboss-development
>
> _______________________________________________
> jboss-development mailing list
> jboss-development at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-development




More information about the jboss-development mailing list