Article View: borland.public.jbuilder.java.language
Article #7357JAVA IO & Memory
From: Shoo
Date: Sun, 24 Jun 2001 08:43
Date: Sun, 24 Jun 2001 08:43
56 lines
2640 bytes
2640 bytes
Hello~~~
I have a question about JAVA IO & Memory
I ran the code(as below) for transferring images.
However, after three minutes, the program stopped and the system showed the
information as follows.
/////////////////////////////////////////////////////////////////////////
Out of Swap Space
ALERT: rf [4916] - out of logical swap
space during brk/sbrk - see swap(1M)
/////////////////////////////////////////////////////////////////////////
It looks like the program ran out of memory.
How can I free the memory in order to execute the program longer???
Or, is there any method in Java similar with "malloc" in c?
Thanks your reply. ^^
try {
ServerSocket server = new ServerSocket( 10000, 10 );
Socket connection = server.accept();
BufferedInputStream input
= new BufferedInputStream(connection.getInputStream());
Socket client = new Socket("doom-atm", 20000);
BufferedOutputStream outputClient1
= new BufferedOutputStream(client.getOutputStream());
////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////
I think the problem probably comes from creating the array or the method
write
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////
int c;
byte [] a = new byte[4096];
while((c = input.read(a, 0 , 4096)) != -1 )
{
outputClient1.write(a, 0 ,c);
}
}// end try
////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////
Technical Details
Message-ID:
<3b360b14_1@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!news.tele.dk!212.74.64.35!colt.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnewsShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,ff189f3c7609b34f,start X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-06-24 08:45:55 PST From: "Shoo" <edwinshoo@supanet.com> Newsgroups: borland.public.jbuilder.java.language Subject: JAVA IO & Memory Date: Sun, 24 Jun 2001 16:43:54 +0800 Lines: 58 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 NNTP-Posting-Host: 62.254.43.49 Message-ID: <3b360b14_1@dnews> X-Trace: dnews 993397524 62.254.43.49 (24 Jun 2001 08:45:24 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!news.tele.dk!212.74.64.35!colt.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews