Sorry folks, hadn't seen the other replies.

@Steve Adding up the sizes of vars is what i was trying to avoid. I'm just trying to find an elegant solving the above

@Josh sizeof() doesn't give the size of the object at runtime (in memory). 




_______________________________________________

Good judgement comes from Experience.
Most of that comes from Bad Judgement.
_______________________________________________




2011/11/28 James Nzomo <kazikubwa@gmail.com>
Thank you aki, that was a very helpful insight (really).
Are there any C++ 1337s on the list who have encountered this problem and solved it?
I am trying to avoid painstaking workarounds such as adding up the size of each member or using JSON.

Anyone?



_______________________________________________

Good judgement comes from Experience.
Most of that comes from Bad Judgement.
_______________________________________________




2011/11/28 aki <aki275@gmail.com>
@James, a very nice question. When I was reading into OOP in C#, this was my primary concern for many months as they get stored in the heap. Variables, arrays etc holds much less in the stack, but then  also learnt that memory these days does not cost the price of a computer as the early days so it was not a major issue. However, I once did see a single program take up 100% of the memory, yet the OS was only taking up less than 15% due to the nature of GUI and I refused to purchase the software. My apprentice view. :-)


On Mon, Nov 28, 2011 at 10:56 AM, James Nzomo <kazikubwa@gmail.com> wrote:
Has anyone here successfully (and accurately) determined the size of a C++ class instance (Object) in memory during run time?




_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
------------
List info, subscribe/unsubscribe
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------

Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke