• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

I/O unhandle Streams

 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

There is problem for deleting file from my temperary folder , i keeping file.exists check and then i try to delete.. file.delete
But 100 time i think only 2 or 3 times it deleted

it gives me false as response every time.

but problem is here , when i searched for this solution every one says.. you have close all the streams.. , and some say System.gc() is good solution , for me really it helped
but i don't want to use

Could any one tell me solution or any tool available for see the streams..not for memory leak. please.

TOOL or plugin for eclipse really helpful now i am using

Regards
KVA
 
Sheriff
Posts: 22649
126
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
System.gc() isn't a good option. It may help, but it doesn't take away the cause of the problem.

Usually you put all your streams in a try-finally block, with optional catch blocks. For instance:
No matter what happens inside the try block, the input stream will be closed.
 
kajal mukergi
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok I will do that , out of interest i want to know IS THERE ANY TOOL EXISTING FOR SEEING THE OPEN STREAMS
 
Rob Spoor
Sheriff
Posts: 22649
126
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No need to shout; KeepItDown.

On Windows you can use Process Explorer. It can do a lot more, but finding open "handles" is one of its functionalities. On Linux / UNIX you can try lsof. Both will just say that java.exe has the lock though.
 
kajal mukergi
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Friend,

Sorry if the above message is interpreted as "Shout" , I only wanted to highlight it.

It is really sad to hear that we don't have any tool yet.. after these many years of JAVA arrival..

Ok Bad but really sad.
 
You guys wanna see my fabulous new place? Or do you wanna look at this tiny ad?
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic