question about memory usage (classes)

33 views
Skip to first unread message

Artem Batogovsky

unread,
Mar 26, 2014, 5:37:09 AM3/26/14
to v8-u...@googlegroups.com
In file ClassA takes 180 retained bits on first new, and 80 for all next
ClassB takes 152 retained bits on first new, and 52 for all next

Why it is? For what each bit was taken?

There are some information to read about this?

Thank you for help in understanding =)

p.s. I analyze heap before and after 10 clicks, with heap snapshot
test.html

Gregory Hlavac

unread,
Mar 26, 2014, 8:49:02 AM3/26/14
to v8-u...@googlegroups.com
https://developers.google.com/v8/design

That should elaborate enough for you.

Artem Batogovsky

unread,
Mar 26, 2014, 10:11:04 AM3/26/14
to v8-u...@googlegroups.com
Thank you, but

I read this one, and many other articles, it is not an answer, i still don't understand how each byte of memory is spent.

Середа, 26 березня 2014 р. 16:49:02 UTC+4 користувач Gregory Hlavac написав:

Artem Batogovsky

unread,
Mar 26, 2014, 10:33:07 AM3/26/14
to v8-u...@googlegroups.com
Okay, may be it is too hard to calculate each bite. But situation that i explain in file was not explained at all.

It will be great if you will say what exactly differ one class from another (ClassA and ClassB).

Середа, 26 березня 2014 р. 16:49:02 UTC+4 користувач Gregory Hlavac написав:

Sven Panne

unread,
Mar 27, 2014, 4:18:14 AM3/27/14
to v8-u...@googlegroups.com
On Wed, Mar 26, 2014 at 3:33 PM, Artem Batogovsky <batog...@gmail.com> wrote:
Okay, may be it is too hard to calculate each bite. But situation that i explain in file was not explained at all.

It will be great if you will say what exactly differ one class from another (ClassA and ClassB).

Short answer: Functions are stateful objects in JavaScript, and each instance of the inner function in ClassA has to remember its own "inc".

Artem Batogovsky

unread,
Mar 27, 2014, 5:52:07 AM3/27/14
to v8-u...@googlegroups.com
Thank you!

There are any way to see real memory consumption? Because i saw with memory profiler in chrome - it is 28 bites diference, it looks like more than one integer variable.

Четвер, 27 березня 2014 р. 12:18:14 UTC+4 користувач Sven Panne написав:
Reply all
Reply to author
Forward
0 new messages