Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 235
  • Last Modified:

Object's size

How can I measure an object's size, in terms of memory?

I have this method, getting me stuff(1D or 2D arrays usually), and I want to check their size before I serialize them and tx them over a network.

1 Solution
you can't. And the size in memory != the serialized size anyway.

To check the serialized size before transmitting you could serialize to a buffer using ByteArrayOutputStream, and check the size of the buffer.
piouAuthor Commented:
Thanks! The byte array stream does it okay.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now