On Mar 1, 2010, at 10:48 AM, Caleb James DeLisle wrote:

> By clearing the XWikiContext in the tearDown of the unit test, I can
> stop the memory leak and stop running the tests in isolation. I am
> proposing we apply this change because the XWikiContext is created
> per test and the worst problem which can be created is tests
> erroneously passing which I don't think is very likely from a change
> like this.

+1 for the main reason that this improves build times. The  second reason is 
that it makes memory leaks more visible which gives us a better chance to find 
them (although this won't replace performance tests running over a few days for 
ex).

However please add a comment just above the getContext().clear() to explain why 
this is needed. BTW why is it needed? :)

Thanks
-Vincent

> 
> Jira issue: http://jira.xwiki.org/jira/browse/XWIKI-4953
> Patch:
> http://jira.xwiki.org/jira/secure/attachment/16788/XWIKI-4496-patchTestMemoryLeak.patch
> 
> Patch content:
> 
> Index: core/xwiki-core/pom.xml
> ===================================================================
> --- core/xwiki-core/pom.xml   (revision 27357)
> +++ core/xwiki-core/pom.xml   (working copy)
> @@ -823,10 +823,6 @@
>       <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-surefire-plugin</artifactId>
> -        <configuration>
> -          <!-- Prevent Out Of Memory errors resulting from tests
> that do no free up the memory correctly -->
> -          <forkMode>pertest</forkMode>
> -        </configuration>
>       </plugin>
>       <!-- Publish a Core Test JAR -->
>       <plugin>
> Index:
> core/xwiki-core/src/test/java/com/xpn/xwiki/test/AbstractBridgedXWikiComponentTestCase.java
> ===================================================================
> ---
> core/xwiki-core/src/test/java/com/xpn/xwiki/test/AbstractBridgedXWikiComponentTestCase.java
> (revision 27357)
> +++
> core/xwiki-core/src/test/java/com/xpn/xwiki/test/AbstractBridgedXWikiComponentTestCase.java
> (working copy)
> @@ -80,6 +80,7 @@
>     protected void tearDown() throws Exception
>     {
>         Utils.setComponentManager(null);
> +        getContext().clear();
>         super.tearDown();
>     }
> 
> 
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs

_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to