You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ni...@apache.org on 2010/10/09 03:55:02 UTC

svn commit: r1006099 - /commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java

Author: niallp
Date: Sat Oct  9 01:55:02 2010
New Revision: 1006099

URL: http://svn.apache.org/viewvc?rev=1006099&view=rev
Log:
IO-161 Try garbage collecting before trying to fill memory

Modified:
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java?rev=1006099&r1=1006098&r2=1006099&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java Sat Oct  9 01:55:02 2010
@@ -302,6 +302,8 @@ public class FileCleaningTrackerTestCase
     }
 
     private void waitUntilTrackCount() throws Exception {
+        System.gc(); 
+        Thread.sleep(500);
         int count = 0;
         while(theInstance.getTrackCount() != 0 && count++ < 5) {
             List<String> list = new ArrayList<String>();
@@ -312,7 +314,6 @@ public class FileCleaningTrackerTestCase
                 }
             } catch (Throwable ignored) {
             }
-            list.clear();
             list = null;
             System.gc(); 
             Thread.sleep(1000);



Re: svn commit: r1006099 - /commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java

Posted by Niall Pemberton <ni...@gmail.com>.
On Sat, Oct 9, 2010 at 6:51 PM, Jörg Schaible <jo...@gmx.de> wrote:
> Gary Gregory wrote:
>
>> Check. I wonder how sun tests the jre for this...
>
> Yeah. I have also some test where I'd like to minimize the JVM's available
> memory just for the test ....

You can configure the maven-surefire-plugin to limit memory (the IO's
pom has that) - but thats for all tests and perhaps not what you
wanted.

Niall


> - Jörg

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: svn commit: r1006099 - /commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java

Posted by Jörg Schaible <jo...@gmx.de>.
Gary Gregory wrote:

> Check. I wonder how sun tests the jre for this...

Yeah. I have also some test where I'd like to minimize the JVM's available 
memory just for the test ....

- Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: svn commit: r1006099 - /commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java

Posted by Gary Gregory <GG...@seagullsoftware.com>.
Check. I wonder how sun tests the jre for this...

Gary

On Oct 9, 2010, at 3:55, "sebb" <se...@gmail.com> wrote:

> The intention is not to cause OOM, but to cause the JVM to flush the
> references by reducing the free memory.
> 
> On 9 October 2010 08:03, Gary Gregory <GG...@seagullsoftware.com> wrote:
>> Random thought:
>> 
>> Instead of trying to cause an OutOfMemoryException, how about throwing this exception ourselves from a (test) subclass of the IO class in that we are trying to break?
>> 
>> Gary
>> 
>> -----Original Message-----
>> From: niallp@apache.org [mailto:niallp@apache.org]
>> Sent: Friday, October 08, 2010 18:55
>> To: commits@commons.apache.org
>> Subject: svn commit: r1006099 - /commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java
>> 
>> Author: niallp
>> Date: Sat Oct  9 01:55:02 2010
>> New Revision: 1006099
>> 
>> URL: http://svn.apache.org/viewvc?rev=1006099&view=rev
>> Log:
>> IO-161 Try garbage collecting before trying to fill memory
>> 
>> Modified:
>>    commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java
>> 
>> Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java
>> URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java?rev=1006099&r1=1006098&r2=1006099&view=diff
>> ==============================================================================
>> --- commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java (original)
>> +++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java Sat Oct  9 01:55:02 2010
>> @@ -302,6 +302,8 @@ public class FileCleaningTrackerTestCase
>>     }
>> 
>>     private void waitUntilTrackCount() throws Exception {
>> +        System.gc();
>> +        Thread.sleep(500);
>>         int count = 0;
>>         while(theInstance.getTrackCount() != 0 && count++ < 5) {
>>             List<String> list = new ArrayList<String>();
>> @@ -312,7 +314,6 @@ public class FileCleaningTrackerTestCase
>>                 }
>>             } catch (Throwable ignored) {
>>             }
>> -            list.clear();
>>             list = null;
>>             System.gc();
>>             Thread.sleep(1000);
>> 
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: svn commit: r1006099 - /commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java

Posted by Niall Pemberton <ni...@gmail.com>.
It seems to be working better now. Continuum ran 23 builds last night
without a fail. I was hoping to do 30, but the machine went down.

Niall

On Sat, Oct 9, 2010 at 11:54 AM, sebb <se...@gmail.com> wrote:
> The intention is not to cause OOM, but to cause the JVM to flush the
> references by reducing the free memory.
>
> On 9 October 2010 08:03, Gary Gregory <GG...@seagullsoftware.com> wrote:
>> Random thought:
>>
>> Instead of trying to cause an OutOfMemoryException, how about throwing this exception ourselves from a (test) subclass of the IO class in that we are trying to break?
>>
>> Gary
>>
>> -----Original Message-----
>> From: niallp@apache.org [mailto:niallp@apache.org]
>> Sent: Friday, October 08, 2010 18:55
>> To: commits@commons.apache.org
>> Subject: svn commit: r1006099 - /commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java
>>
>> Author: niallp
>> Date: Sat Oct  9 01:55:02 2010
>> New Revision: 1006099
>>
>> URL: http://svn.apache.org/viewvc?rev=1006099&view=rev
>> Log:
>> IO-161 Try garbage collecting before trying to fill memory
>>
>> Modified:
>>    commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java
>>
>> Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java
>> URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java?rev=1006099&r1=1006098&r2=1006099&view=diff
>> ==============================================================================
>> --- commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java (original)
>> +++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java Sat Oct  9 01:55:02 2010
>> @@ -302,6 +302,8 @@ public class FileCleaningTrackerTestCase
>>     }
>>
>>     private void waitUntilTrackCount() throws Exception {
>> +        System.gc();
>> +        Thread.sleep(500);
>>         int count = 0;
>>         while(theInstance.getTrackCount() != 0 && count++ < 5) {
>>             List<String> list = new ArrayList<String>();
>> @@ -312,7 +314,6 @@ public class FileCleaningTrackerTestCase
>>                 }
>>             } catch (Throwable ignored) {
>>             }
>> -            list.clear();
>>             list = null;
>>             System.gc();
>>             Thread.sleep(1000);
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: svn commit: r1006099 - /commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java

Posted by sebb <se...@gmail.com>.
The intention is not to cause OOM, but to cause the JVM to flush the
references by reducing the free memory.

On 9 October 2010 08:03, Gary Gregory <GG...@seagullsoftware.com> wrote:
> Random thought:
>
> Instead of trying to cause an OutOfMemoryException, how about throwing this exception ourselves from a (test) subclass of the IO class in that we are trying to break?
>
> Gary
>
> -----Original Message-----
> From: niallp@apache.org [mailto:niallp@apache.org]
> Sent: Friday, October 08, 2010 18:55
> To: commits@commons.apache.org
> Subject: svn commit: r1006099 - /commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java
>
> Author: niallp
> Date: Sat Oct  9 01:55:02 2010
> New Revision: 1006099
>
> URL: http://svn.apache.org/viewvc?rev=1006099&view=rev
> Log:
> IO-161 Try garbage collecting before trying to fill memory
>
> Modified:
>    commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java
>
> Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java
> URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java?rev=1006099&r1=1006098&r2=1006099&view=diff
> ==============================================================================
> --- commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java (original)
> +++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java Sat Oct  9 01:55:02 2010
> @@ -302,6 +302,8 @@ public class FileCleaningTrackerTestCase
>     }
>
>     private void waitUntilTrackCount() throws Exception {
> +        System.gc();
> +        Thread.sleep(500);
>         int count = 0;
>         while(theInstance.getTrackCount() != 0 && count++ < 5) {
>             List<String> list = new ArrayList<String>();
> @@ -312,7 +314,6 @@ public class FileCleaningTrackerTestCase
>                 }
>             } catch (Throwable ignored) {
>             }
> -            list.clear();
>             list = null;
>             System.gc();
>             Thread.sleep(1000);
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


RE: svn commit: r1006099 - /commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java

Posted by Gary Gregory <GG...@seagullsoftware.com>.
Random thought:

Instead of trying to cause an OutOfMemoryException, how about throwing this exception ourselves from a (test) subclass of the IO class in that we are trying to break?

Gary

-----Original Message-----
From: niallp@apache.org [mailto:niallp@apache.org] 
Sent: Friday, October 08, 2010 18:55
To: commits@commons.apache.org
Subject: svn commit: r1006099 - /commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java

Author: niallp
Date: Sat Oct  9 01:55:02 2010
New Revision: 1006099

URL: http://svn.apache.org/viewvc?rev=1006099&view=rev
Log:
IO-161 Try garbage collecting before trying to fill memory

Modified:
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java?rev=1006099&r1=1006098&r2=1006099&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java Sat Oct  9 01:55:02 2010
@@ -302,6 +302,8 @@ public class FileCleaningTrackerTestCase
     }
 
     private void waitUntilTrackCount() throws Exception {
+        System.gc(); 
+        Thread.sleep(500);
         int count = 0;
         while(theInstance.getTrackCount() != 0 && count++ < 5) {
             List<String> list = new ArrayList<String>();
@@ -312,7 +314,6 @@ public class FileCleaningTrackerTestCase
                 }
             } catch (Throwable ignored) {
             }
-            list.clear();
             list = null;
             System.gc(); 
             Thread.sleep(1000);