Closed Bug 722595 Opened 12 years ago Closed 12 years ago

Add memory reporters for misc things hanging off JS objects

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla13

People

(Reporter: n.nethercote, Assigned: n.nethercote)

References

(Blocks 1 open bug)

Details

(Whiteboard: [MemShrink:P3])

Attachments

(1 file)

Attached patch patchSplinter Review
This patch: 

- Measures a few more small JS things.  I probably shouldn't have bothered,
  judging from Gmail they'll be lucky to reach 0.01% of total explicit, but
  it's done now.

- Tree-ifies the "object-slots" and "object-elements" reporters.

- Better separates JSObject::computedSizeOfThisSlotsElements() and 
  JSObject::sizeOfExcludingThis() -- the latter now always takes a non-NULL
  |mallocSizeOf| argument.
  
- Converts some reinterpret_casts to static_casts in vm/ArgumentsObject.h.
Attachment #592950 - Flags: review?(bhackett1024)
=> - Measures a few more small JS things.  I probably shouldn't have bothered,
>   judging from Gmail they'll be lucky to reach 0.01% of total explicit, but
>   it's done now.

Oops, I meant 0.1%!
Whiteboard: [MemShrink] → [MemShrink:P3]
Comment on attachment 592950 [details] [diff] [review]
patch

Review of attachment 592950 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/jsobjinlines.h
@@ +1233,5 @@
> +        *miscSize += toFunction()->sizeOfMisc(mallocSizeOf);
> +    } else if (isArguments()) {
> +        *miscSize += asArguments().sizeOfMisc(mallocSizeOf);
> +    } else if (isRegExpStatics()) {
> +        *miscSize += mallocSizeOf(getPrivate());

Can you put this in a SizeOfRegExpStaticsData or something which is near the existing private accessors on RegExpStatics objects?

::: js/src/vm/GlobalObject.cpp
@@ +512,5 @@
>      return true;
>  }
>  
> +size_t
> +GlobalObject::sizeOfMisc(JSMallocSizeOfFun mallocSizeOf) const

This doesn't seem to get called under sizeOfExcludingThis?
Attachment #592950 - Flags: review?(bhackett1024) → review+
> > +size_t
> > +GlobalObject::sizeOfMisc(JSMallocSizeOfFun mallocSizeOf) const
> 
> This doesn't seem to get called under sizeOfExcludingThis?

Good catch!  The RegExpStatics hangs off the GlobalObject so I thought I needed this but then I realized that normal heap enumeration will hit the RegExpStatics object anyway.  But I forgot to remove it.  Thanks.
https://hg.mozilla.org/mozilla-central/rev/fff20ca00084
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla13
You need to log in before you can comment on or make changes to this bug.