tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Very Long Full GC after Inactivity
Date Wed, 10 Oct 2007 14:19:03 GMT
Hash: SHA1


Peter Crowther wrote:
> The messy way: Run Tomcat as an admin (ick!) and make a JNI call to
> some native code that pins Tomcat's address space into RAM.

Messy indeed.

> I have not tried this, don't know whether there's a "correct" JVM way
> of doing it, and have *no* idea how it might interact with Sun's
> address space management!  It's something to try very, very
> cautiously - this might bite you in unexpected ways.

My experience with JNI is that you have to pin objects one at a time.
Since Tomcat manages millions of objects, I'm not sure how you'd do this
effectively. Also, I believe that pinning an object does more than make
is non-relocatable within the heap (see below); I think that if you
pinned objects indefinitely, Bad Things would probably happen. One Bad
Thing that will probably happen is that objects will never be tenured,
and you'll fill up other parts of your heap with objects that ought to
be promoted to more long-lasting areas of the heap.

Finally, pinning an object has no bearing on its "pagability"... it just
means that a native pointer can be used to access it, and the memory
address where the object can be found won't change until it's unpinned.
The memory can still be swapped to disk, as long as the memory address
for that object does not change. Heck, it can even be relocate in
physical memory of the OS wants to do it (which it probably will do
during paging), as long as the process can always use that same pointer
to access the object.

I'd imagine that most OSs have functions to /actually/ pin data into
memory (making is non-pagable). In order to do that, you'd have to
Java-pin the object, then OS-pin the memory. I think that's going to
cause lots more problems than a long wait for the first request of the
day ;)

I actually favor your "cheap way" since it's super simple and likely to
work just as well ;)

- -chris
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla -


To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message