Sign in to follow this  

Optimizing the Serializing of Objects in Java

This topic is 4186 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, I've begun to notice something like this with large objects that I serialize in Java: -Suppose a program is using 50 megs of memory before serialization -All the objects are serialized in order to 'save the state' of the program, if we wanted to restart the program from a given moment in time. It creates a file 18 megs in size. -Upon deserialization, the program is using almost 100 megs of memory! Has anyone noticed this type of problem before, or is it something I'm doing wrong with the way I'm serializing objects...to me it doesnt make sense that if I am essentially loading the state of a program thats been saved to file for my memory usage to be so much higher. Any insights will be appreciated.

Share this post


Link to post
Share on other sites
Well, doing the unserialization prolly requires some intermediate storing of data, and as Java is automatically garbage collecting, it also means it doesn't unless it has to.

So my guess is that most of that is just dead memory, trying forcing garbage collection after loading and see how much it uses.

Share this post


Link to post
Share on other sites

This topic is 4186 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this