You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by "Vamsavardhana Reddy (JIRA)" <ji...@apache.org> on 2006/12/27 11:33:21 UTC

[jira] Updated: (GERONIMO-1464) Avoid use of file.deleteOnExit() - will cause allocation of 1K of memory per call until JVM terminates

     [ http://issues.apache.org/jira/browse/GERONIMO-1464?page=all ]

Vamsavardhana Reddy updated GERONIMO-1464:
------------------------------------------

    Attachment: G-1464.patch

G-1464.patch:

I have scanned the trunk (rev 490474) and found references to deleteOnExit() in the following classes:
o DatabasePoolPortlet
o ActiveMQConnectorHelper
o AbstractHandler
o RepositoryViewPortlet
o SecurityRealmPortlet
o DeploymentContextTest
o AbstractDeployCommand
o FileUploadServlet
o DeploymentUtil
o PluginInstallerGBean

Except for PluginInstallerGBean, all other classes are calling deleteOnExit() immediately upon creating a temporary file.  PluginInstallerGBean is calling deleteOnExit() when delete() fails.  Except for DeploymentUtil, I have replaced the use of deleteOnExit() by first attempting a delete and calling deleteOnExit() only when delete fails.  The patch has taken care of the scope of the file usage.  IMO, this patch is definitely an improvement over what exists now.

> Avoid use of file.deleteOnExit() - will cause allocation of 1K of memory per call until JVM terminates
> ------------------------------------------------------------------------------------------------------
>
>                 Key: GERONIMO-1464
>                 URL: http://issues.apache.org/jira/browse/GERONIMO-1464
>             Project: Geronimo
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>          Components: Memory Leaks
>    Affects Versions: 1.0
>            Reporter: John Sisson
>            Priority: Minor
>             Fix For: Wish List
>
>         Attachments: G-1464.patch
>
>
> I haven't run into a memory problem but came across this bug in Sun's bug database and a number of people warning not to use deleteOnExit() in server code.
> According to http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4513817 each call to file.deleteOnExit() will allocate 1K of memory until the JVM terminates.  I have not had the chance to verify it, but I have raised this JIRA in case someone is tracking a memory leak in the future or someone has time to review our usage of deleteOnExit().  

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira