lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dawid Weiss (JIRA)" <>
Subject [jira] [Commented] (LUCENE-4252) Detect/Fail tests when they leak RAM in static fields
Date Sat, 28 Jul 2012 20:18:34 GMT


Dawid Weiss commented on LUCENE-4252:

Yep, looks good to me and makes sense. When I was thinking about static initializers I had
in mind twisted scenarios like:
static {
  KlassB.staticField = new byte [gazillion];
but this will be nearly impossible to detect given that you can fan out from a static initializer
to other classes etc. Doesn't make sense to try to make it super complex.

What we could do though is to make it not only a lint rule but also an additional cleanup
rule, similar to system property invariant guard and cleanup. We could then add this automatic
static field cleanup (on the suite class) to the set of class rules on LuceneTestCase. Perhaps
it'd make it cleaner compared to manual cleanups done in @AfterClass or similar hooks?
> Detect/Fail tests when they leak RAM in static fields
> -----------------------------------------------------
>                 Key: LUCENE-4252
>                 URL:
>             Project: Lucene - Core
>          Issue Type: Test
>          Components: general/test
>            Reporter: Robert Muir
>            Assignee: Dawid Weiss
>         Attachments: LUCENE-4252.patch, LUCENE-4252.patch
> We run our junit tests without firing up a JVM each time.
> But some tests initialize lots of stuff in @BeforeClass and don't properly null it out
in an @AfterClass, which can cause a subsequent test in the same JVM to OOM, which is difficult
to debug.
> Inspiration for this was me committing Mike's cool TestPostingsFormat, which forgot to
do this: then we were seeing OOMs in several jenkins runs.
> We should try to detect these leaks in LuceneTestCase with RAMUsageEstimator and fail
the test.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message