Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4813777
Votes 0
Synopsis File.deleteOnExit() should only remember each pathname once
Category java:classes_io
Reported Against 1.4
Release Fixed
State 11-Closed, duplicate of 4809375, request for enhancement
Priority: 3-Medium
Related Bugs 4809375
Submit Date 06-FEB-2003
Description


FULL PRODUCT VERSION :
java version "1.4.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
Java HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)

Also occurs with
java version "1.4.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)


FULL OPERATING SYSTEM VERSION :
[  xxxxx@xxxxx   len]$ rpm -query glibc
glibc-2.2.4-24
[  xxxxx@xxxxx   len]$ uname -a
Linux nepenthes 2.4.19 #1 Tue Aug 6 12:16:08 NZST 2002 i686
unknown
[  xxxxx@xxxxx   len]$ cat /etc/ customer -release
Red Hat Linux release 7.2 (Enigma)





A DESCRIPTION OF THE PROBLEM :
Calling File.deleteOnExit() always allocates memory outside
the JVM, even if it has already been called for the same
abstract pathname (even if it has already been called for
the same File  customer !). Calling deleteOnExit() multiple
times for the same abstract pathname should not consume more
memory than calling it once.



STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1.See supplied test code.

EXPECTED VERSUS ACTUAL BEHAVIOR :
Memory should not be consumed when running the
test program.

Actual results is that the jvm increases in size unboundedly.




REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
class Test {
  // Call deleteOnExit() on the same File  customer .
  // Shouldn't consume memory but does.
  public static void main(String[] args) {
    try {
      java.io.File test = java.io.File.createTempFile("test",".tst");
      while (true) {
        test.deleteOnExit();
      }
    } catch (Exception e){e.printStackTrace();}
  }
}

---------- END SOURCE ----------

CUSTOMER WORKAROUND :
Do not call deleteOnExit more than once per abstract pathname.
(Review ID: 180849) 
======================================================================
Posted Date : 2005-09-01 20:55:53.0
Work Around
N/A
Evaluation
Sounds reasonable. There are also other problems with the deleteOnExit structs that should be addressed at the same time.
  xxxxx@xxxxx   2003-02-06
This issue will be fixed as part of the re-implementation of the deleteOnExit mechanism (4809375).
Posted Date : 2005-11-25 09:19:49.0
Comments
  
  Include a link with my name & email   

Submitted On 05-MAR-2007
aleh_b
The issue still exists.  Tested against 1.5.0_10-b03, 1.5.0_09-b01 (Windows, 32bit).

You can reproduce the issue even without creating a file itself.

            File f = new File("deleteOnExit.txt");
            while (true) {
                f.deleteOnExit();
            }



PLEASE NOTE: JDK6 is formerly known as Project Mustang