Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Outofmemory Error in ObjectInputStream

 
Velmurugan Krishnan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all

In our application we are Serializing the Object from one process (JVM) and deserializing the same Object from another process(JVM). Both serialization and deserialization will happen concurrently from Different JVM.

We are often getting OOM while de-serialization of the Object. We are using jdk 1.4 for compilation and Jre 1.6 for Running the JVM.

We have allocated 512Mb for the Process which is doing the deserialization. We have analyzed the hprof file is just 50Mb, JVM is not dumping the 512Mb.

We have googled about this OOM and suspecting that ObjectinputStream is leaking the Memory

is it a defect in ObjectInputStream ?

Could any one help us on this ?

The stack trace is

Exception in thread "Thread-9" java.lang.OutOfMemoryError: Java heap space
at java.lang.reflect.Array.newArray(Native Method)
at java.lang.reflect.Array.newInstance(Array.java:52)
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1631)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1323)
at java.io.ObjectInputStream.access$300(ObjectInputStream.java:188)
at java.io.ObjectInputStream$GetFieldImpl.readFields(ObjectInputStream.java:2109)
at java.io.ObjectInputStream.readFields(ObjectInputStream.java:519)
at java.lang.StringBuffer.readObject(StringBuffer.java:625)
at sun.reflect.GeneratedMethodAccessor81.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1849)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1667)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1323)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at java.util.Hashtable.readObject(Hashtable.java:859)
at sun.reflect.GeneratedMethodAccessor82.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1849)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)




Thanks
Velmurugan
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is suggesting to periodically call reset().
 
Velmurugan Krishnan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Thanks a lot for your reply,

The serialization happens in different JVM with respect to de-serialization.

Moreover, we are calling the reset of ObjectOutputStream while doing the Serialization.



How can we prevent the OOM at de-serialization at this JVM ? what could be the root cause for this OOM ?

Thanks
Velmurugan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic