dev@mimepull.java.net

patch for MIMEPULL-13

From: Mamoru WATANABE <watanabe.ma.1st_at_gmail.com>
Date: Mon, 4 May 2015 19:34:26 +0900

MIMEPULL-13: Use of File.deleteOnExit leaks memory
https://java.net/jira/browse/MIMEPULL-13

I'm facing the same problem.
so I created a patch to fix this problem.

I created new class named TempFileCleaner.
This class has two public methods: register(File) and delete(File).
register method is to add file to delete.
delete method is to delete file actually.

if the file deletion fails, the deletion processing is periodically
and automatically executed.
if periodic deletion processing fails in predefined number of times,
the cleaner invokes the deleteOnExit method.

then TempFileCleaner registers shutdown hook.
when java vm shuts down, if the cleaner yet has files to delete,
the cleaner deletes all files. and files that failed to delete,
invoke the deleteOnExit method.

-- 
Mamoru Watanabe
watanabe.ma.1st_at_gmail.com