Obtaining the byte size of an instantiated object.

D

Daz

Hi everyone.

I'd like to know if it's possible to obtain the size (in bytes), of an
instantiated object. I'm not actually sure if this is possible, but
basically, I am needing to create about 140,000 objects, which will be
kept in an array, and I need to try and find out just how much RAM it
will use.

In case you are wondering, the objects are quite small, but they need
to be searched through more than once to find possible solutions to a
mathmatical equation, where the input varies. I don't want to have to
create 140,000 objects each time the user wants to search, as to me
that just seems unproductive.

Can anyone point me in the right direction?

Many thanks.

Daz.
 
D

dd

I'd like to know if it's possible to obtain the size (in bytes), of an
instantiated object. I'm not actually sure if this is possible, but
basically, I am needing to create about 140,000 objects, which will be
kept in an array, and I need to try and find out just how much RAM it
will use.

Here's what I would try, although it's not necessarily going
to be totally accurate and all kinds of things may influence
it. I'd make a very simple test page, and load it in the browser
and look in the windows task manager at the browser memory
usage.

On your simple test page you'd have a link that you can click
which would add 10,000 of your objects. Click it once, make
a note of the increase in memory usage. Do that a few times
and see if it's a reliable and constant increase. Like I said,
it's not the most reliable and scientific way of doing it, but it's
something ;-) Better than nothing.
 
D

Daz

Here's what I would try, although it's not necessarily going
to be totally accurate and all kinds of things may influence
it. I'd make a very simple test page, and load it in the browser
and look in the windows task manager at the browser memory
usage.

On your simple test page you'd have a link that you can click
which would add 10,000 of your objects. Click it once, make
a note of the increase in memory usage. Do that a few times
and see if it's a reliable and constant increase. Like I said,
it's not the most reliable and scientific way of doing it, but it's
something ;-) Better than nothing.

Thanks for your idea. I am quite sure that it would be more than ample
to give me a rough idea of how much memory my objects use up. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top