OLD | NEW |
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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 (uintptr_t) ptr, size); | 430 (uintptr_t) ptr, size); |
431 #ifdef TODO_REENABLE_STACK_TRACING | 431 #ifdef TODO_REENABLE_STACK_TRACING |
432 DumpStackTrace(1, RawInfoStackDumper, NULL); | 432 DumpStackTrace(1, RawInfoStackDumper, NULL); |
433 #endif | 433 #endif |
434 } | 434 } |
435 if (saved_munmap_hook) { // call MemoryRegionMap's hook | 435 if (saved_munmap_hook) { // call MemoryRegionMap's hook |
436 (*saved_munmap_hook)(ptr, size); | 436 (*saved_munmap_hook)(ptr, size); |
437 } | 437 } |
438 } | 438 } |
439 | 439 |
440 static void SbrkHook(const void* result, ptrdiff_t increment) { | 440 static void SbrkHook(const void* result, std::ptrdiff_t increment) { |
441 if (FLAGS_mmap_log) { // log it | 441 if (FLAGS_mmap_log) { // log it |
442 RAW_LOG(INFO, "sbrk(inc=%"PRIdS") = 0x%"PRIxPTR"", | 442 RAW_LOG(INFO, "sbrk(inc=%"PRIdS") = 0x%"PRIxPTR"", |
443 increment, (uintptr_t) result); | 443 increment, (uintptr_t) result); |
444 #ifdef TODO_REENABLE_STACK_TRACING | 444 #ifdef TODO_REENABLE_STACK_TRACING |
445 DumpStackTrace(1, RawInfoStackDumper, NULL); | 445 DumpStackTrace(1, RawInfoStackDumper, NULL); |
446 #endif | 446 #endif |
447 } | 447 } |
448 if (saved_sbrk_hook) { // call MemoryRegionMap's hook | 448 if (saved_sbrk_hook) { // call MemoryRegionMap's hook |
449 (*saved_sbrk_hook)(result, increment); | 449 (*saved_sbrk_hook)(result, increment); |
450 } | 450 } |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 | 612 |
613 // class used for finalization -- dumps the heap-profile at program exit | 613 // class used for finalization -- dumps the heap-profile at program exit |
614 struct HeapProfileEndWriter { | 614 struct HeapProfileEndWriter { |
615 ~HeapProfileEndWriter() { HeapProfilerDump("Exiting"); } | 615 ~HeapProfileEndWriter() { HeapProfilerDump("Exiting"); } |
616 }; | 616 }; |
617 | 617 |
618 // We want to make sure tcmalloc is up and running before starting the profiler | 618 // We want to make sure tcmalloc is up and running before starting the profiler |
619 static const TCMallocGuard tcmalloc_initializer; | 619 static const TCMallocGuard tcmalloc_initializer; |
620 REGISTER_MODULE_INITIALIZER(heapprofiler, HeapProfilerInit()); | 620 REGISTER_MODULE_INITIALIZER(heapprofiler, HeapProfilerInit()); |
621 static HeapProfileEndWriter heap_profile_end_writer; | 621 static HeapProfileEndWriter heap_profile_end_writer; |
OLD | NEW |