Miloslaw Smyk wrote:
> "John D. Mitchell" wrote:
> >
> > >>>>> "Miloslaw" == Miloslaw Smyk <[EMAIL PROTECTED]> writes:
> > [...]
> > > Just a quick question: how can I calculate amount of memory that is used
> > > by an object running under JVM on Linux?
> >
> > There is an answer for this question in the jGuru Java Language FAQ:
> > http://www.jGuru.com/faq/JavaLanguage
>
> Yeah, it says it is impossible during runtime. :)
>
> But I meant something different, forgive me for phrasing it poorly.
>
> I have an image synthesis app that creates hundreds of thousands of objects
> at the beginning, and later it only gets worse. If I knew how much memory
> I'm wasting with each object created, e.g. how heavy is full OO approach vs.
> putting some stuff in tables, I'd be able to tune my app better. Currently
> I've no idea if for example making all my pixels into objects is really hard
> on memory. I can gather some information from "ps aux", but it's really
> imprecise.
The info from ps will be useless, but you can get a ballpark figure by
computing Runtime.totalMemory() - Runtime.freeMemory() (calling Runtime.gc()
before the computation should prevent dead objects from skewing the
statistics). This is still very rough: there's no data on individual object
memory use, but at least you'll get an idea of overall use from your various
approaches.
Nathan
>
>
> So: can anyone tell me how much memory overhead hotspot adds for each object
> created under Linux JVM? If it is not constant value I'd appreciate even a
> ballpark figure.
>
> Thanks,
> Milek
> --
> mailto:[EMAIL PROTECTED] | "Man in the Moon and other weird things" -
> http://wfmh.org.pl/~thorgal/ | see it at http://wfmh.org.pl/~thorgal/Moon/
> Fight for the good cause: http://www.laubzega.com/dvd/
>
> ----------------------------------------------------------------------
> To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]