Results 1 to 4 of 4
Thread: Socket Class Leak
- 02-15-2010, 12:28 PM #1
Member
- Join Date
- Feb 2010
- Posts
- 2
- Rep Power
- 0
Socket Class Leak
Hello all,
After i close an opened socket connection using java.net.Socket class
in linux OS , there are some resources left residing in memory ,
shown as 'can't identify protocol ' in the output of lsof command.
After some time and after connecting and disconnecting many times, this leak causes the system error "Too many open files".
How can I make sure all resources reserved by the opened sockets are released properly?
thanks.Last edited by mbmsit; 02-15-2010 at 12:31 PM.
- 02-15-2010, 03:22 PM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
Show us some code around where you open and close the Sockets.
(Please use CODE tags)
- 02-19-2010, 02:28 AM #3
Are using an open source JVM or one from Sun? Ubuntu comes with an open source JVM by default, and I had some problems with it. The Sun JVM works fine.
- 02-20-2010, 12:09 PM #4
Member
- Join Date
- Feb 2010
- Posts
- 2
- Rep Power
- 0
this is my code
this code executes sleep duration (100) seconds ,Java Code:try { Socket s=new Socket("192.168.0.253",143); System.out.println("connect..."); s.close(); try { Thread.sleep(100000);System.out.println("asd"); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }
in this duration , i detect opened connections by :
"lsof -p 'process number' "
same error is displayed :
"can't identify protocol"
i have installed sun jvm , nothing new.
where is the problem ???
Similar Threads
-
swt socket
By cuiran in forum SWT / JFaceReplies: 2Last Post: 01-22-2010, 01:34 AM -
Help I have a memory leak...
By cdman52 in forum Java AppletsReplies: 10Last Post: 09-28-2009, 10:37 PM -
append response to the request from Socket and write to another socket
By vaibhav_singh_vs@yahoo.co in forum NetworkingReplies: 3Last Post: 04-17-2009, 07:02 PM -
java.util.logging.StreamHandler memory leak?
By toadaly in forum Advanced JavaReplies: 1Last Post: 02-23-2009, 02:46 PM -
Memory Leak using a Swing Application Project
By iimasd in forum AWT / SwingReplies: 0Last Post: 11-27-2007, 10:20 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks