|
-
Oct 13th, 2002, 09:41 PM
#1
Thread Starter
Member
How much memory do classes use?
I am trying to work out how much memory a particular class, I have created, uses. It is a simple class that has about a dozen private variables, a few properties and a few public methods. The thing is that when running my app, there could be up to 10,000 instances of it in memory. My concern is that it will use too much memory. How do I tell what amount of memory my class will use? Do the properties and methods only get set once or are they repeated for each instance and what is the overhead?
Any Clues?
Alan Liddle
-
Oct 15th, 2002, 04:51 AM
#2
Usage per class:
size of all static properties + code size of all methods and getters/setters
Usage per instance:
size of all non-static properties + 4 bytes per virtual function in this class and all base classes + 4/8 bytes for the reference (4 on 32-bit systems, 8 on 64-bit systems) + overhead of allocation (I guess ~20 bytes)
I think that's it.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|