Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(567)

Issue 4888001: Provide more accurate results about used heap size via GetHeapStatistics. (Closed)

Created:
10 years, 1 month ago by mnaganov (inactive)
Modified:
9 years, 7 months ago
CC:
v8-dev
Visibility:
Public.

Description

Provide more accurate results about used heap size via GetHeapStatistics. I observed that used heap size provided by Heap::SizeOfObjects() is usually about ~10% bigger than the number calculated by summing up heap objects sizes. This aligns DevTools Timeline stats with Heap profiler stats. Committed: http://code.google.com/p/v8/source/detail?r=5825

Patch Set 1 #

Total comments: 1

Patch Set 2 : Aligned sizes reported by Heap::SizeOfObjects and HeapIterator with free nodes filtering #

Total comments: 23

Patch Set 3 : Fix Anton's comments #

Total comments: 10

Patch Set 4 : Fix Slava's comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+208 lines, -37 lines) Patch
M src/heap.h View 1 2 3 chunks +23 lines, -6 lines 0 comments Download
M src/heap.cc View 1 2 3 6 chunks +93 lines, -15 lines 0 comments Download
M src/heap-profiler.cc View 1 chunk +3 lines, -5 lines 0 comments Download
M src/mark-compact.h View 1 chunk +3 lines, -0 lines 0 comments Download
M src/mark-compact.cc View 3 chunks +8 lines, -8 lines 0 comments Download
M src/spaces.h View 7 chunks +19 lines, -1 line 0 comments Download
M src/spaces.cc View 7 chunks +30 lines, -2 lines 0 comments Download
M test/cctest/test-heap.cc View 1 chunk +29 lines, -0 lines 0 comments Download

Messages

Total messages: 9 (0 generated)
mnaganov (inactive)
10 years, 1 month ago (2010-11-12 10:43:38 UTC) #1
Mads Ager (chromium)
As discussed offline I think we need to investigate this a bit more. http://codereview.chromium.org/4888001/diff/1/src/heap.h File ...
10 years, 1 month ago (2010-11-12 11:11:27 UTC) #2
mnaganov (inactive)
On 2010/11/12 11:11:27, Mads Ager wrote: > As discussed offline I think we need to ...
10 years, 1 month ago (2010-11-12 21:58:13 UTC) #3
mnaganov (inactive)
On 2010/11/12 21:58:13, Michail Naganov wrote: > On 2010/11/12 11:11:27, Mads Ager wrote: > > ...
10 years, 1 month ago (2010-11-13 17:21:38 UTC) #4
antonm
DBCs http://codereview.chromium.org/4888001/diff/6001/src/heap.cc File src/heap.cc (left): http://codereview.chromium.org/4888001/diff/6001/src/heap.cc#oldcode4408 src/heap.cc:4408: if (FreeListNode::IsFreeListNode(obj)) continue; thank you very much! http://codereview.chromium.org/4888001/diff/6001/src/heap.cc ...
10 years, 1 month ago (2010-11-13 17:37:51 UTC) #5
mnaganov (inactive)
http://codereview.chromium.org/4888001/diff/6001/src/heap.cc File src/heap.cc (right): http://codereview.chromium.org/4888001/diff/6001/src/heap.cc#newcode4852 src/heap.cc:4852: bool marked = object->IsMarked(); On 2010/11/13 17:37:51, antonm wrote: ...
10 years, 1 month ago (2010-11-13 19:05:30 UTC) #6
Mads Ager (chromium)
Slava would be the right person to review this patch.
10 years, 1 month ago (2010-11-15 08:31:55 UTC) #7
Vyacheslav Egorov (Chromium)
LGTM http://codereview.chromium.org/4888001/diff/15001/src/heap.cc File src/heap.cc (right): http://codereview.chromium.org/4888001/diff/15001/src/heap.cc#newcode4836 src/heap.cc:4836: class FreeListNodesFilter : public Malloced { Is it ...
10 years, 1 month ago (2010-11-15 09:33:21 UTC) #8
mnaganov (inactive)
10 years, 1 month ago (2010-11-15 10:36:17 UTC) #9
Thank you very much!

http://codereview.chromium.org/4888001/diff/15001/src/heap.cc
File src/heap.cc (right):

http://codereview.chromium.org/4888001/diff/15001/src/heap.cc#newcode4836
src/heap.cc:4836: class FreeListNodesFilter : public Malloced {
On 2010/11/15 09:33:21, Vyacheslav Egorov wrote:
> Is it really necessary to separate this class from HeapIterator and malloc it?

I made it separate from HeapIterator because it's a helper class, and even its
declaration isn't needed outside. But it's a part of HeapIterator's state, so I
needed to put it inside HeapIterator. My solution is to forward-declare it in
heap.h.

OK, it's not necessary to make it a subclass of Malloced.

http://codereview.chromium.org/4888001/diff/15001/src/heap.cc#newcode4851
src/heap.cc:4851: static int ObjectSize(HeapObject* object) {
On 2010/11/15 09:33:21, Vyacheslav Egorov wrote:
> There is CountMarkedCallback which does exactly what you need but better
(saves
> two memory writes).
> 
> map_word.ClearMark() does not clear mark in object's map word. map_word is a
> value type.

Oh, you are right. I didn't noticed that MapWord is a value type. I made
CountMarkedCallback public in MarkCompactCollector and renamed it to
SizeOfMarkedObject.

http://codereview.chromium.org/4888001/diff/15001/src/heap.cc#newcode4870
src/heap.cc:4870: ObjectIterator* iter = new
HeapObjectIterator(Heap::code_space());
On 2010/11/15 09:33:21, Vyacheslav Egorov wrote:
> I think there is no need to use new here.

Done.

http://codereview.chromium.org/4888001/diff/15001/src/heap.cc#newcode4896
src/heap.cc:4896: Shutdown();
On 2010/11/15 09:33:21, Vyacheslav Egorov wrote:
> You should assert here that iteration was not interrupted to guarantee that
heap
> was not left in inconsistent state.

Done.

http://codereview.chromium.org/4888001/diff/15001/src/heap.cc#newcode4903
src/heap.cc:4903: filter_ = new FreeListNodesFilter;
On 2010/11/15 09:33:21, Vyacheslav Egorov wrote:
> It would be cool to forbid allocation/gc while precise HeapIterator is alive.

I've included AssertNoAllocation into FreeListNodesFilter.

Powered by Google App Engine
This is Rietveld 408576698