Closed Bug 730447 Opened 9 years ago Closed 9 years ago
GC: Create a real counter for malloc bytes
This is work toward bug 681479. Right now we do a GC whenever 100MB of malloc memory has been allocated. This patch tries to improve this heuristic. It keeps a count of how many malloc bytes are allocated at any time. This requires that callers of free know how many bytes are being freed. It seems like in all the important cases, we know this. Once we know how many malloc bytes there are, we can use the usual heuristic of GCing when malloc bytes reach lastMallocBytes*3. The big advantage of this approach is that we can track any malloc bytes, even if they're very short-lived. The check whether to do a GC or not happens in MaybeGC. So even if lots of memory is allocated and then quickly freed, it won't cause a GC as long as a MaybeGC doesn't happen in between. I'm hoping this will allow people in Gecko to inform the JS engine of all malloc bytes, regardless of whether they're GCable or not. This should help a lot in cases where a GC would free lots of objects, but we're just not smart enough to GC right now.
Attachment #600527 - Flags: review?(anygregor)
Thanks for doing this--we've had several bad GC bugs in the past because of the old, inaccurate, accounting.
Comment on attachment 600527 [details] [diff] [review] patch Where is triggerMallocGC used?
Attachment #600527 - Flags: review?(anygregor) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/e4f70bd4f96d I took out triggerMallocGC. It wasn't supposed to be there.
Target Milestone: --- → mozilla13
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.