| Index: test/cctest/cctest.h
|
| diff --git a/test/cctest/cctest.h b/test/cctest/cctest.h
|
| index 193126a0818e91a1aac21a900c0b0db476c7467d..f18bf5db90fe661d2ea43d2255324ed18eb86a31 100644
|
| --- a/test/cctest/cctest.h
|
| +++ b/test/cctest/cctest.h
|
| @@ -300,4 +300,38 @@ static inline void SimulateFullSpace(v8::internal::PagedSpace* space) {
|
| }
|
|
|
|
|
| +// Helper class for new allocations tracking and checking
|
| +class HeapObjectsTracker {
|
| + public:
|
| + HeapObjectsTracker() {
|
| + heap_profiler_ = i::Isolate::Current()->heap_profiler();
|
| + CHECK_NE(NULL, heap_profiler_);
|
| +
|
| + heap_profiler_->StartHeapObjectsTracking();
|
| +
|
| + HEAP->CollectAllAvailableGarbage();
|
| + HEAP->CollectAllAvailableGarbage();
|
| + HEAP->CollectAllAvailableGarbage();
|
| + untracked_on_start_ = heap_profiler_->CheckAllocationsTracking();
|
| + }
|
| +
|
| + virtual ~HeapObjectsTracker() {
|
| + CHECK_GE(0, test());
|
| + heap_profiler_->StopHeapObjectsTracking();
|
| + }
|
| +
|
| + int test() {
|
| + HEAP->CollectAllAvailableGarbage();
|
| + HEAP->CollectAllAvailableGarbage();
|
| + HEAP->CollectAllAvailableGarbage();
|
| +
|
| + return heap_profiler_->CheckAllocationsTracking() - untracked_on_start_;
|
| + }
|
| +
|
| + private:
|
| + i::HeapProfiler* heap_profiler_;
|
| + int untracked_on_start_;
|
| +};
|
| +
|
| +
|
| #endif // ifndef CCTEST_H_
|
|
|