Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 184371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:16:49+00:00 2026-05-11T15:16:49+00:00

I use serialization, in order to estimate the amount of memory used for an

  • 0

I use serialization, in order to estimate the amount of memory used for an object. I already read this, and this. So I know that it may be better to use a profiler or sizeof (for value types).

I would like to know, what is the exact difference between the serialized object and the object in memory ? In what measure is serialization reliable for object size estimation ?

I am especially interested in C# serialization mechanisms.

  • 1 1 Answer
  • 5 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T15:16:49+00:00Added an answer on May 11, 2026 at 3:16 pm

    The serialized form of data is not the same as in-memory; for example, a collection/dictionary will involve multiple objects for the items, the arrays, hash-buckets/indexes, etc – but the raw data (when serialized) will typically be just the data – so you might see less volume when serialized.

    Equally, things like BinaryFormatter have to include a lot of (verbose) type metadata – but in the objects it just has a (terse) type handle in the object handle – so you might see more data in the serialized data. Likewise, the serializer (unless it is manually optimized) needs to tokenize the individual fields – but in memory this is implicit in the offset from the objects address.

    So you might get a number from serialization, but it is not the same number.

    To get an accurate idea of the size of an object graph is tricky. SOS might help; otherwise, create a whole shed-load of them and divide. Crude, but it might just work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good day. I know that in order to save object state in Java I
Is it practical / possible to use serialization to read data from an RSS
I imagine to use XML serialization like this: class Foo { public Foo (string
When using XML serialization in C#, I use code like this: public MyObject LoadData()
I'm trying to use nHibernate, Spring and WCF together. I've got an Order object,
I'm starting to use boost::serialization on XML archives. I can produce and read data,
in order to obfuscate application code but still be able to use serialization to
I am planning to use serialization to do clone. I have to make my
Related: How can I use polymorphism in XML Serialization? I have a class I
I'm trying to use Protocol Buffers for message serialization. My message format should contain

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.