views:

6043

answers:

3

Is there a tool/plugin/function for Firefox that'll dump out a memory usage of Javascript objects that you create in a page/script? I know about Firebug's profiler but I'd like something more than just times. Something akin to what Yourkit has for Java profiling of memory usage.

Reason is that a co-worker is using id's for "keys" in an array and is creating 1000's of empty slots when he does this. He's of the opinion that this is harmless whereas I differ. I'd like to offer some proof to prove whether I'm right or not.

Thanks in advance.

+3  A: 

I think JavaScript Memory Validator from Software Verification Limited can help you, it has allocations view, objects view, generations view, etc. It's not free but you can use the evaluation version to check your coworker's code. They also have a Performance and Coverage Validators...

CMS
Yes, Javascript Memory Validator is a great tool. It has many unique features.
Olivvv
+3  A: 

See the source. Sparse arrays don't take up lots of memory, but if your colleague doesn't need any Array functionality, he should be using plain Objects anyway.

Nickolay
+3  A: 

I haven't tried the Sofware verify tools, but Mozilla has tools that track overall memory consumed by firefox for the purpose of stemming leaks:

http://www.mozilla.org/performance/tools.html

and:

https://wiki.mozilla.org/Performance:Leak_Tools

There's also this guy saying to avoid large arrays in the context of closures, towards article bottom

http://ajax.sys-con.com/node/352585

Gene T