J
Jeff
In the course of struggling with a bug, a data structure that I don't know
about showed up as the largest instance count. Can someone give me a bit
of background on this structure?
Briefly, my client receives objects by reading an object input stream.
After a few thousand objects, the client experiences a java.stack overflow.
I have gotten a stack trace that indicates it's the deserialization process
causing the stack overflow. There's lots written on serialization and the
stack, but I haven't been able to fix the bug.
I used OptimizeIt to profile the client:
* int[] had the largest instance count.
* java.i
bjectInputStream$HandleTable$HandleList had the second largest
instance count at 143579 before the stack overflow.
3 questions:
1. What's the HandleList? Should it grow so large?
2. Is there an int array associated with it?
3. If the heap gets too large, shouldn't it throw a outOfMemory error? Or
could my heap being running into my stack?
CLIENT CODE
Socket sock = new Socket( ipAddress , port );
is = new ObjectInputStream( sock.getInputStream() );
while (true) {
Object result = (Object) is.readObject();
// other processing
}
SERVER CODE
ServerSocket serverSock = new ServerSocket(port);
sock = serverSock.accept();
while (true) {
os = new ObjectOutputStream( sock.getOutputStream() );
os.writeObject( outboundObject );
os.reset();
os.flush();
}
Thanks
about showed up as the largest instance count. Can someone give me a bit
of background on this structure?
Briefly, my client receives objects by reading an object input stream.
After a few thousand objects, the client experiences a java.stack overflow.
I have gotten a stack trace that indicates it's the deserialization process
causing the stack overflow. There's lots written on serialization and the
stack, but I haven't been able to fix the bug.
I used OptimizeIt to profile the client:
* int[] had the largest instance count.
* java.i
instance count at 143579 before the stack overflow.
3 questions:
1. What's the HandleList? Should it grow so large?
2. Is there an int array associated with it?
3. If the heap gets too large, shouldn't it throw a outOfMemory error? Or
could my heap being running into my stack?
CLIENT CODE
Socket sock = new Socket( ipAddress , port );
is = new ObjectInputStream( sock.getInputStream() );
while (true) {
Object result = (Object) is.readObject();
// other processing
}
SERVER CODE
ServerSocket serverSock = new ServerSocket(port);
sock = serverSock.accept();
while (true) {
os = new ObjectOutputStream( sock.getOutputStream() );
os.writeObject( outboundObject );
os.reset();
os.flush();
}
Thanks