You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2016/06/17 09:53:39 UTC

[Bug 59166] util TempFile could cause memory leak

https://bz.apache.org/bugzilla/show_bug.cgi?id=59166

Javen O'Neal <on...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #3 from Javen O'Neal <on...@apache.org> ---
None of the POI unit tests run long enough to experience the problems you're
experiencing. While we could register just the directory for deletion on JVM
exit, this strategy seems dangerous if the directory was not empty before
starting or a separate application wrote data to the directory. Under these
conditions, data loss could occur.

Another strategy for long-running processes is to keep a fixed-length queue of
files and delete the files FIFO as the queue overflows.
This would mean not registering deleteOnExit with the JVM, so you would need to
intercept a JVM exit message to delete the files remaining in the queue before
the JVM shut down.

You could also implement a strategy that deletes all temp files that have been
created. This is essentially the same as above using a variable-length set that
never implicitly deletes files.

I don't think any of these strategies are safe enough to implement without
getting into trouble: either leaving temp files behind or accidentally deleting
files that shouldn't have been deleted. If you have a better
TempFileCreationStrategy that would appeal to many users, feel free to re-open
this bug with the corresponding patch.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org