object byte size

From: Jéjé (jerome.eteve_at_it-omics.com)
Date: 11/28/03


Date: Fri, 28 Nov 2003 11:22:58 +0100

Hi everyone.
 I'm currently implementing a Cache system.
Limiting its capacity with the number of object makes no sense, since
objects can have any size they want.

So I'd like to limit its capacity in term of number of bytes allready
cached. Therefore, I need to know what is the size in byte of any
object in the heap.

I thought about serializing the object to an array of byte, but this
method implies that the user is forced to make its objects serializable,
which is neither practical, nor kind to him or her.
Furthermore, serializing objects just to know their size in byte is
not efficient.

Is there a way to do this in a simple and elegant way ?

Thanks for your answers.

Jérôme.

-- 
--
He's just a politician trying to save both his faces...
----------------------------
jerome.eteve_at_it-omics.com


Relevant Pages

  • Re: object byte size
    ... > I'm currently implementing a Cache system. ... > Limiting its capacity with the number of object makes no sense, ... Runtime runtime = Runtime.getRuntime; ...
    (comp.lang.java)
  • Re: object byte size
    ... > Limiting its capacity with the number of object makes no sense, ... serializing objects just to know their size in byte ... To 'mark' a class as 'cacheable' you could implement an interface, ... implementing the 'Cloneable' interface encounter - no means of ensuring each ...
    (comp.lang.java)
  • Re: Steam engines - tender first?
    ... "astern" thus limiting their available power. ... Some branch line locos ... had full capacity as had all tank engines.. ...
    (uk.railway)
  • Re: England: the mother of modern sport
    ... grounds compared with those of Seria A etc. RH ... Are many Championship matches sold out then? ... capacity was a limiting factor for many of the teams. ...
    (uk.sport.cricket)