Hello…
I am using serialization to send stuff from a client to a server… here is the server loop code:
try{
while(runMe){
Object obj = myStreamReader.readObject();
incomingMessage=(NetworkMessage)obj;
parseInput(); //Parses the client request and sends an answer
incomingMessage=null;
}
}catch(Exception e){System.out.println("Connection thread: error "+e+" handling client for "+mySocket);}
I don’t know what I m doing wrong… but I get a memory leak, the heap keeps growing and growing, until I get the outofmemory exception. I tried commenting out the parseInput() method, in case I m keeping some open references during the handling of the messages… nothing…
Is there anything I need to do to clear the ObjectInputStream 's own references to the retrieved objects? The problem seems to lie there, but I wasn’t able to find any info about it.
Here is the reference tree:
http://mauryr.bounceme.net/images/references.gif
I seem to understand from this the only reference is from the ObjectInputStream itself.
Thanks everybody for your help.