From: SourceForge.net <no...@so...> - 2007-03-09 17:35:12
|
Patches item #1669597, was opened at 2007-02-26 19:39 Message generated for change (Comment added) made by cgroves You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312867&aid=1669597&group_id=12867 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Alexander J Smith (wargolem) Assigned to: Nobody/Anonymous (nobody) Summary: fix for IO flush bug Initial Comment: Fixed the problem by adding an Observable object to the Runtime shutdown hooks, which notifies its observers when it runs. FileWrappers now observe this object and flush when they are notified. It adds a minimal amount of code to solve the problem. Authored by Alexander Smith, Eric Dobbs - 2/26/07 ---------------------------------------------------------------------- >Comment By: Charles Groves (cgroves) Date: 2007-03-09 12:35 Message: Logged In: YES user_id=1174327 Originator: NO Unfortunately, this will cause a memory leak if the user isn't closing files. The Observable class IOShutdownHook is extending holds onto a hard reference to everything that's observing it(the FileWrapper), and the FileWrappers are only removed from the IOShutdownHook when they're closed, so they'll stay resident in memory even if all of the program's references go out of scope. Perhaps using a java.lang.ref.WeakReference to wrap the FileWrapper in the IOShutdown hook could keep the hook from holding it in memory, and then adding a finalizer to perform the close on the file wrapper would solve the problem. ---------------------------------------------------------------------- Comment By: Alexander J Smith (wargolem) Date: 2007-02-26 19:56 Message: Logged In: YES user_id=1218590 Originator: YES File Added: ioflush.txt ---------------------------------------------------------------------- Comment By: Alexander J Smith (wargolem) Date: 2007-02-26 19:42 Message: Logged In: YES user_id=1218590 Originator: YES File Added: ioflush.txt ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312867&aid=1669597&group_id=12867 |