473,387 Members | 1,790 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Obtaining the byte size of an instantiated object.

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.

Apr 24 '07 #1
3 4325
Daz said the following on 4/24/2007 10:22 AM:
Hi everyone.

I'd like to know if it's possible to obtain the size (in bytes), of an
instantiated object.
With Javascript? Not even close.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 24 '07 #2
dd
On Apr 24, 4:22 pm, Daz <cutenfu...@gmail.comwrote:
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.
Apr 26 '07 #3
Daz
On Apr 26, 10:59 am, dd <dd4...@gmail.comwrote:
On Apr 24, 4:22 pm, Daz <cutenfu...@gmail.comwrote:
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.
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. :)

Apr 29 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jéjé | last post by:
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...
5
by: Martin | last post by:
Dear Group Sorry for posting this here. I'm desperate for a solution to this problem and thought some of you might have come across it with .NET and SQL Server. Let's assume I've the following...
8
by: ishekara | last post by:
Hi all, An object of a class A which has no member variables and no member functions, still the size of the object is 1 byte, if there is a byte member variable then also the size of the object...
16
by: Samuel Thomas | last post by:
Hello Friends, I understand(could be wrong) that the smallest chunk of memory is called a word. If that is correct, that means if I am using a 32 bit OS a word is 4 bytes. So that's why the size...
4
by: Shashi | last post by:
Can somebody explain how the byte alignment for structures work, taking the following example and considering: byte of 1 Byte word of 2 Bytes dword of 4 Bytes typedef struct { byte a; word...
17
by: cpptutor2000 | last post by:
Could some C guru help me please? A byte is an unsigned char in C. How do I convert from a C string to a corresponding byte array. Any help would be greatly appreciated.
3
by: Kamalanathan T. | last post by:
Hi, We have developed an Web application in ASP.NET with C# and we r using SQL Server 2000. We get the Timeout expired error, when more than 300 concurrent users hit the site. I hagone thru...
4
by: taskswap | last post by:
I'm converting an application that relies heavily on a binary network protocol. Within this protocol are a lot of byte arrays of character data, like: public unsafe struct MsgAddEntry {...
7
by: =?Utf-8?B?Sm9obiBTdGFnZ3M=?= | last post by:
Hello, Please read this all before giving an answer :) I'm doing some troubleshooting on a web application that my company wrote. It's written in asp.net 1.1. The error that the Event viewer...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.