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

Side by Side Diff: third_party/tcmalloc/chromium/src/heap-checker.cc

Issue 9310021: [NOT TO COMMIT!] Merge Chromium-specific changes in tcmalloc thru. the original gperftools r136. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fixed some build inhibitor. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2005, Google Inc. 1 // Copyright (c) 2005, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 1453 matching lines...) Expand 10 before | Expand all | Expand 10 after
1464 // a byte sequence in memory that matches an address of 1464 // a byte sequence in memory that matches an address of
1465 // a heap object which is in fact leaked. 1465 // a heap object which is in fact leaked.
1466 // I.e. in very rare and probably not repeatable/lasting cases 1466 // I.e. in very rare and probably not repeatable/lasting cases
1467 // we might miss some real heap memory leaks. 1467 // we might miss some real heap memory leaks.
1468 RAW_VLOG(14, "Found pointer to %p of %"PRIuS" bytes at %p " 1468 RAW_VLOG(14, "Found pointer to %p of %"PRIuS" bytes at %p "
1469 "inside %p of size %"PRIuS"", 1469 "inside %p of size %"PRIuS"",
1470 ptr, object_size, object, whole_object, whole_size); 1470 ptr, object_size, object, whole_object, whole_size);
1471 if (VLOG_IS_ON(15)) { 1471 if (VLOG_IS_ON(15)) {
1472 // log call stacks to help debug how come something is not a leak 1472 // log call stacks to help debug how come something is not a leak
1473 HeapProfileTable::AllocInfo alloc; 1473 HeapProfileTable::AllocInfo alloc;
1474 if (!heap_profile->FindAllocDetails(ptr, &alloc)) { 1474 bool r = heap_profile->FindAllocDetails(ptr, &alloc);
1475 RAW_LOG(FATAL, "FindAllocDetails failed on ptr %p", ptr); 1475 r = r; // suppress compiler warning in non-debug mode
1476 } 1476 RAW_DCHECK(r, ""); // sanity
1477 RAW_LOG(INFO, "New live %p object's alloc stack:", ptr); 1477 RAW_LOG(INFO, "New live %p object's alloc stack:", ptr);
1478 for (int i = 0; i < alloc.stack_depth; ++i) { 1478 for (int i = 0; i < alloc.stack_depth; ++i) {
1479 RAW_LOG(INFO, " @ %p", alloc.call_stack[i]); 1479 RAW_LOG(INFO, " @ %p", alloc.call_stack[i]);
1480 } 1480 }
1481 } 1481 }
1482 live_object_count += 1; 1482 live_object_count += 1;
1483 live_byte_count += object_size; 1483 live_byte_count += object_size;
1484 live_objects->push_back(AllocObject(ptr, object_size, 1484 live_objects->push_back(AllocObject(ptr, object_size,
1485 IGNORED_ON_HEAP)); 1485 IGNORED_ON_HEAP));
1486 } 1486 }
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
2363 // static 2363 // static
2364 const void* HeapLeakChecker::GetAllocCaller(void* ptr) { 2364 const void* HeapLeakChecker::GetAllocCaller(void* ptr) {
2365 // this is used only in the unittest, so the heavy checks are fine 2365 // this is used only in the unittest, so the heavy checks are fine
2366 HeapProfileTable::AllocInfo info; 2366 HeapProfileTable::AllocInfo info;
2367 { SpinLockHolder l(&heap_checker_lock); 2367 { SpinLockHolder l(&heap_checker_lock);
2368 RAW_CHECK(heap_profile->FindAllocDetails(ptr, &info), ""); 2368 RAW_CHECK(heap_profile->FindAllocDetails(ptr, &info), "");
2369 } 2369 }
2370 RAW_CHECK(info.stack_depth >= 1, ""); 2370 RAW_CHECK(info.stack_depth >= 1, "");
2371 return info.call_stack[0]; 2371 return info.call_stack[0];
2372 } 2372 }
OLDNEW
« no previous file with comments | « third_party/tcmalloc/chromium/src/google/profiler.h ('k') | third_party/tcmalloc/chromium/src/heap-profile-table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698