Closed Bug 673840 Opened 13 years ago Closed 13 years ago

Reduce js-gc-heap-arena-used

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

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

References

Details

(Whiteboard: [MemShrink:P3])

Attachments

(1 file)

Bug 671702 is looking at reducing space wasted in chunks.  In this bug I want to look at reducing space wasted in arenas.

We have 18 different kinds of GC "thing", and each arena only holds a single kind of thing.  I think all these kinds are to speed up GC, but it creates a lot of potential for partially-full arenas.

The attached patch adds some instrumentation of arenas.  For each arena kind, it counts:
- the number of arenas of that kind;
- the number of bytes unused in those arenas;
- the number of bytes used in those arenas.

(Nb: I don't want to necessarily land this patch.)

Here are the numbers after I opened gmail and TechCrunch.

           46 -- js-gc-heap-arena-count-EXTERNAL_STRING
        2,239 -- js-gc-heap-arena-count-FUNCTION
           51 -- js-gc-heap-arena-count-OBJECT0
          128 -- js-gc-heap-arena-count-OBJECT0_BACKGROUND
           12 -- js-gc-heap-arena-count-OBJECT12
           33 -- js-gc-heap-arena-count-OBJECT12_BACKGROUND
           12 -- js-gc-heap-arena-count-OBJECT16
           11 -- js-gc-heap-arena-count-OBJECT16_BACKGROUND
          930 -- js-gc-heap-arena-count-OBJECT2
          314 -- js-gc-heap-arena-count-OBJECT2_BACKGROUND
           78 -- js-gc-heap-arena-count-OBJECT4
          693 -- js-gc-heap-arena-count-OBJECT4_BACKGROUND
          212 -- js-gc-heap-arena-count-OBJECT8
          580 -- js-gc-heap-arena-count-OBJECT8_BACKGROUND
        2,666 -- js-gc-heap-arena-count-SHAPE
          588 -- js-gc-heap-arena-count-SHORT_STRING
          505 -- js-gc-heap-arena-count-STRING
            1 -- js-gc-heap-arena-count-XML

  6,365,856 B -- js-gc-heap-arena-unused

    153,536 B -- js-gc-heap-arena-unused-EXTERNAL_STRING
    476,544 B -- js-gc-heap-arena-unused-FUNCTION
    151,632 B -- js-gc-heap-arena-unused-OBJECT0
    267,264 B -- js-gc-heap-arena-unused-OBJECT0_BACKGROUND
     42,840 B -- js-gc-heap-arena-unused-OBJECT12
     54,768 B -- js-gc-heap-arena-unused-OBJECT12_BACKGROUND
     30,000 B -- js-gc-heap-arena-unused-OBJECT16
     15,600 B -- js-gc-heap-arena-unused-OBJECT16_BACKGROUND
  1,149,984 B -- js-gc-heap-arena-unused-OBJECT2
    465,872 B -- js-gc-heap-arena-unused-OBJECT2_BACKGROUND
    104,520 B -- js-gc-heap-arena-unused-OBJECT4
    766,168 B -- js-gc-heap-arena-unused-OBJECT4_BACKGROUND
    417,384 B -- js-gc-heap-arena-unused-OBJECT8
    376,448 B -- js-gc-heap-arena-unused-OBJECT8_BACKGROUND
  1,032,960 B -- js-gc-heap-arena-unused-SHAPE
    296,064 B -- js-gc-heap-arena-unused-SHORT_STRING
    560,576 B -- js-gc-heap-arena-unused-STRING
      3,696 B -- js-gc-heap-arena-unused-XML

     33,408 B -- js-gc-heap-arena-used-EXTERNAL_STRING
  8,407,808 B -- js-gc-heap-arena-used-FUNCTION
     54,000 B -- js-gc-heap-arena-used-OBJECT0
    248,832 B -- js-gc-heap-arena-used-OBJECT0_BACKGROUND
      5,544 B -- js-gc-heap-arena-used-OBJECT12
     78,288 B -- js-gc-heap-arena-used-OBJECT12_BACKGROUND
     18,000 B -- js-gc-heap-arena-used-OBJECT16
     28,400 B -- js-gc-heap-arena-used-OBJECT16_BACKGROUND
  2,614,656 B -- js-gc-heap-arena-used-OBJECT2
    805,200 B -- js-gc-heap-arena-used-OBJECT2_BACKGROUND
    211,848 B -- js-gc-heap-arena-used-OBJECT4
  2,044,640 B -- js-gc-heap-arena-used-OBJECT4_BACKGROUND
    418,744 B -- js-gc-heap-arena-used-OBJECT8
  1,911,072 B -- js-gc-heap-arena-used-OBJECT8_BACKGROUND
  9,716,352 B -- js-gc-heap-arena-used-SHAPE
  2,074,752 B -- js-gc-heap-arena-used-SHORT_STRING
  1,491,744 B -- js-gc-heap-arena-used-STRING
        336 B -- js-gc-heap-arena-used-XML

Some questions:  the ratios between used and unused vary quite a bit.  Eg. the used:unused ratio is almost 10:1 for SHAPE, almost 18:1 for FUNCTION, but barely more than 2:1 for OBJECT2.  I'm not sure what the significance of that is.

Also, there were only a dozen or so compartments open.

Hmm, I wonder if generational GC will help here the most, due to the usual story -- by filtering out a lot of short-lived things in the nursery, we'll end up freeing a smaller portion of things on the heap during each non-nursery collection, leaving fewer holes, resulting in less in-arena space being wasted.
Depends on: 648320
Whiteboard: [MemShrink] → [MemShrink:P3]
This bug isn't going anywhere, and arenas might end up being shrunk to 2KB for compartment-per-global anyway.
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: