aspose file tools
The moose likes Java in General and the fly likes Is serialization implementation may cause inadequate heap size memory? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Is serialization implementation may cause inadequate heap size memory?" Watch "Is serialization implementation may cause inadequate heap size memory?" New topic
Author

Is serialization implementation may cause inadequate heap size memory?

Birla Murugesan
Ranch Hand

Joined: Nov 25, 2008
Posts: 66

Is serialization implementation may cause inadequate heap size memory?

Is it possible?
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2896
    
    1

Serialization is simply, storing and retrieving the objects and it should not cause the inadequate heap size, especially during deserialization of objects. Leave everything else to the GC.


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Birla Murugesan
Ranch Hand

Joined: Nov 25, 2008
Posts: 66
Sagar Rohankar wrote:Serialization is simply, storing and retrieving the objects and it should not cause the inadequate heap size, especially during deserialization of objects. Leave everything else to the GC.



see,serialization is the process which do the object caching,so if the cached object not go for deserialization for a long time which might lead to inadequate heap size
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2896
    
    1

Birla Murugesan wrote:
Sagar Rohankar wrote:Serialization is simply, storing and retrieving the objects and it should not cause the inadequate heap size, especially during deserialization of objects. Leave everything else to the GC.

see,serialization is the process which do the object caching

But "caching space" is not necessarily be the heap space, because when you want to serialize your objects to the output stream then one might uses file or sockets to flattened the objects, no one uses JVM memory to serialize objects, that's not Serialization concept is used for.

May be reading this article helps you to understand most of the things !
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24061
    
  13

An ObjectOutputStream needs a cache of every object you write to it, so that if you write the same object again, it can substitute a reference to the earlier object, rather than writing a new copy. You'd think that ObjectOutputStream would use WeakReferences in that table, but it does not. Therefore, if you keep an ObjectOutputStream open for a long time, it can be a source of memory leaks, since objects that would otherwise be garbage collected can be retained because of the reference in that cache.

So yes, serialization can cause you to run out of memory, but not for any of the reasons previously discussed in this thread.


[Jess in Action][AskingGoodQuestions]
Birla Murugesan
Ranch Hand

Joined: Nov 25, 2008
Posts: 66

Hi friends,

Thanks for the help in my clarification
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Is serialization implementation may cause inadequate heap size memory?
 
Similar Threads
java.lang.OutOfMemoryError
NX: Persistence in the URLyBird
Difference between Heap memory size and RAM
OutOfMemoryError ??
Problem in using Web Services with WSAD