Re: Memory leak
On 20 apr, 10:46, Erik <erikg...@gmail.com> wrote:
On 20 apr, 01:49, Martin Gregorie <mar...@see.sig.for.address> wrote:
On Sat, 19 Apr 2008 16:11:51 -0700, Erik wrote:
On 20 apr, 00:39, Martin Gregorie <mar...@see.sig.for.address> wrote:
On Sat, 19 Apr 2008 14:09:46 -0700, Erik wrote:
byte[] data = new byte[readSize];
I notice that this buffer is only initialised once and has a greater scope
than data buffer needs in your code. I also notice that you've capitalised
your method names, which is confusing.
What does ReadFile() do? Are you quite sure it isn't extending data?
--
martin@ | Martin Gregorie
gregorie. |
org | Zappa fan & glider pilot
The ReadFile method:
protected int ReadFile(byte[] data)throws IOException{
int dataRead = 0;
try {
dataRead = fileInput[currentFile].read(data);
} catch (IOException e) {
throw e;
}
if(dataRead == -1){
fileInput[currentFile].close();
return -1;
}
return dataRead;
}
There's still a lot of stuff you're not telling us, such as what type of
objects make up fileInput[].
--
martin@ | Martin Gregorie
gregorie. |
org | Zappa fan & glider pilot
Sorry :)
fileInput is a DataInputStream[]
FileData and Message are just classes to transport the data, they just
hold the data.
I think I found the problem. The messages with the byte[] data are
send across a network
using a ObjectOutputStream. I think that the ObjectOutputStream caches
the data. I thought I
had fixed that problem by calling the flush method of the
OutputStream, but apparently this
is not working. So how do I clear the cached data of the
ObjectOutputStream?
Thanks