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 877855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:40:47+00:00 2026-05-15T11:40:47+00:00

To enhance messaging in a cluster, it’s important to know at runtime about how

  • 0

To enhance messaging in a cluster, it’s important to know at runtime about how big a message is (should I prefer processing local or remote).

I could just find frameworks about estimating the object memory size based on java instrumentation. I’ve tested classmexer, which didn’t come close to the serialization size and sourceforge SizeOf.

In a small testcase, SizeOf was around 10% wrong and 10x faster than serialization. (Still transient breaks the estimation completely and since e.g. ArrayList is transient but is serialized as an Array, it’s not easy to patch SizeOf. But I could live with that)

On the other hand, 10x faster with 10% error doesn’t seem very good. Any ideas how I could do better?

Update: I also tested ObjectSize (http://sourceforge.net/projects/objectsize-java). Results seem just good for non-inheritating objects 🙁

  • 1 1 Answer
  • 0 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. Editorial Team
    Editorial Team
    2026-05-15T11:40:48+00:00Added an answer on May 15, 2026 at 11:40 am

    The size a class takes at runtime doesn’t necessarily have any bearing on it’s size in memory. The example you’ve mentioned is transient fields. Other examples include when objects implement Externalizable and handle serialization themselves.

    If an object implements Externalizable or provides readObject()/writeObject() then your best bet is to serialize the object to a memory buffer to find out the size. It’s not going to be fast, but it will be accurate.

    If an object is using the default serialization, then you could amend SizeOf to take into account transient fields.

    After serializing many of the same types of objects, you may be able to build up a “serialization profile” for that type that correlates serialized size with runtime size from SizeOf. This will allow you then to estimate the serialized size quickly (using SizeOf) and then correlate this to runtime size, to arrive at a more accurate result than that provided by SizeOf.

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

Sidebar

Related Questions

Does the opening Window enhance an application's attractiveness? Should it be a picture or
I would like to enhance Eclipse so that when I press a custom key
Assuming I have an open source web server or proxy I can enhance, let's
There are two schools of thought on how to best extend, enhance, and reuse
I am trying to enhance my Logger class with some conditionals to control what
I'm trying to enhance my program with some logging functionality provided by System.Diagnostics .
I want to enhance an application with scripting support like many other applications have,
I am attempting to enhance a internal web application we use. I am using
I can inherit and enhance the ToolBar class by creating a plain C# class,
I want like to enhance spam protection on my site. I've found out that

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.