tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Tomcat JVM not releasing deleted files (lsof show delete inodes taking up disk space)
Date Thu, 02 Oct 2008 18:27:30 GMT
Hash: SHA1


Chad Kellerman wrote:
> To get a better understanding... the application indexes
> uploaded files, the indexing process creates the temporary files then
> removes them.

Can you share the code that actually does this? The javadoc for
File.createTempFile states:

"To arrange for a file created by this method to be deleted
automatically, use the deleteOnExit() method."

If your engineers followed this advice, this may be your problem: the
JVM is waiting until JVM shutdown to actually delete the files. Even if
the code does an explicit File.delete(), the JVM is probably still
hanging onto a reference to the file's directory entry in order to
delete it on exit. That seems like a plausible explanation for why the
files are marked as "deleted" in lsof, but are still being kept alive by
the JVM.

The solution here would be to simply not use File.deleteOnExit; instead,
use File.delete explicitly.

- -chris
Version: GnuPG v1.4.9 (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