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 <ggreg...@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: nia...@apache.org [mailto:nia...@apache.org]
> Sent: Friday, October 08, 2010 18:55
> To: comm...@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-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to