> is not static, so the mem estimator would count that as ram used by the
> object itself.

The estimation actually includes static fields -- if it didn't you
could easily overflow memory simply by allocating static byte[]
buffers or something else. Object-level fields are garbage collected
because the reference is released after the test (unless something
else keeps it; there is no way to tell). Take a look at the LTC:

    .around(new StaticFieldsInvariantRule(STATIC_LEAK_THRESHOLD, true) {
      @Override
      protected boolean accept(java.lang.reflect.Field field) {
        // Don't count known classes that consume memory once.
        if (STATIC_LEAK_IGNORED_TYPES.contains(field.getType().getName())) {
          return false;
        }
        // Don't count references from ourselves, we're top-level.
        if (field.getDeclaringClass() == LuceneTestCase.class) {
          return false;
        }
        return super.accept(field);
      }
    })

Dawid

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to