Re: Cache or memory pools in java



In article <1179858157.928003.256100@xxxxxxxxxxxxxxxxxxxxxxxxxxx>,
prasanna <prasanna81982@xxxxxxxxxxx> wrote:
There is another approach where you can serialize an object and
calculate its size. It does not guarantee the exact size but can get
you closer.

My recent experience with serialization is that what was 700 bytes
serialized using the default implementation took only 50 bytes or so
after I wrote my own custom serialization for the same objects. (This
matters to me because I want to fit it into one single UDP packet and
about 500 bytes seems to be the suggested maximum payload.)

What I left out, I expect, was administrative data for the objects
contained within the topmost object (and most of the administrative
data for the topmost object itself). My custom method would just write
the floats, ints, etc., contained in each nested object to an
ObjectOutputStream rather than write the actual objects themselves.

I expect my custom serialization is a more accurate estimate of the
in-memory cost of these objects than what the default serialization
was. The accuracy of the approach you suggest will therefore depend
entirely upon how the data objects in question are structured: if
there is much administrative data to be serialized, your estimate
could easily be off by a factor 10.

Cheers
Bent D
--
Bent Dalager - bcd@xxxxxxx - http://www.pvv.org/~bcd
powered by emacs
.



Relevant Pages

  • Re: Damn you, FEDEX! or Nikon D40 lost in Springfield, MO blackhole.
    ... the 2 mp Mavica he had been using with a Nikon D40. ... After shopping around, he got me to order one for him. ... The shipper had it insured, but from what I have read it could take weeks to sort this crap out. ... You may get your insurance from FedEx and a couple weeks later they find it and deliver it. ...
    (alt.photography)
  • Serialization problem with IE-Hosted Control
    ... I have a control that manipulates an object that is saved and loaded via ... custom serialization. ... The control must also be able to be hosted through IE. ... the past (using default serialization). ...
    (microsoft.public.dotnet.framework.remoting)
  • Re: Binary serialization
    ... interface, and custom Serialization. ... eg. if I have a ref class with two ... bytes (i.e. only contains class data members, ...
    (microsoft.public.dotnet.general)
  • Re: Before Serialization
    ... For this kind of custom serialization implementation you would most likely ... need to write some sort of pre-processing class, ... A surrogate would work but it requires handling the serialization of every ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Yet another issue with DataColumn inhertiance
    ... The good news is that it is probably possible while the bad news is that ... DataTable uses custom serialization via ISerializable and thus you have to ... only DataColumn is serialized and my derived column ...
    (microsoft.public.dotnet.framework.adonet)