How to find file descriptor leak

A

albright

I have a rather large program that talks over the network with another
program. Changes in the behavior of the other program have revealed a file
descriptor leak in my program. What are some ideas and/or techniques I can
use to track down the leak?
 
B

booxplode

albright said:
I have a rather large program that talks over the network with another
program. Changes in the behavior of the other program have revealed a file
descriptor leak in my program. What are some ideas and/or techniques I can
use to track down the leak?

I'd make sure all InputStream and OutputStream
are used within try ... finally blocks, with
close() in the finally block.

--Joe
 
G

Gordon Beaton

I have a rather large program that talks over the network with another
program. Changes in the behavior of the other program have revealed a file
descriptor leak in my program. What are some ideas and/or techniques I can
use to track down the leak?

On Linux you can look in the process' fd directory in the process file
system (e.g. /proc/pid/fd/) to see what the open descriptors refer to.
Other platforms with a process file system most likely offer a similar
facility.

/gordon
 
A

albright

On Linux you can look in the process' fd directory in the process file
system (e.g. /proc/pid/fd/) to see what the open descriptors refer to.
Other platforms with a process file system most likely offer a similar
facility.

Now why didn't I think of that? It's a windows app but I have a Linux
development environment at home. It's a pretty sad statement when your
home is better equipped to do your job then your office.

Thanks
 
S

Sudsy

Now why didn't I think of that? It's a windows app but I have a Linux
development environment at home. It's a pretty sad statement when your
home is better equipped to do your job then your office.

I don't know about that. I've had a richer, more powerful development
environment at home for /years/! Multiple servers with various J2EE
development and deployment platforms, production, test and QA
environments, etc. Plus multiple RDBMS implementations, Eclipse with
XDoclets, Apache/Tomcat...
I feel that I'd be more productive using the tools I have available
here than I would be in an office environment. That's why I'm a huge
fan of the remote development model. Easier for me to package a tested
ear and transmit to a client than to occupy expensive real-estate
and incur the overhead such as a telephone and other administrative
costs.
But that's just me. YMMV.
 
T

Tim Ward

albright said:
Now why didn't I think of that? It's a windows app but I have a Linux
development environment at home. It's a pretty sad statement when your
home is better equipped to do your job then your office.

Uh?? Well, if you want to know what files are open on Windows you use
Windows tools ... duh!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top