Skip to content

Commit 34725e0

Browse files
committed
Track all the things.
1 parent 885f98c commit 34725e0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

filprofiler/_filpreload.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ __attribute__((visibility("default"))) void fil_dump_peak_to_flamegraph(const ch
101101
// Override memory-allocation functions:
102102
__attribute__((visibility("default"))) void *malloc(size_t size) {
103103
void *result = __libc_malloc(size);
104-
if (size > 1000 && result != NULL && !will_i_be_reentrant && initialized) {
104+
if (!will_i_be_reentrant && initialized) {
105105
will_i_be_reentrant = 1;
106106
add_allocation_hook((size_t)result, size);
107107
will_i_be_reentrant = 0;
@@ -112,7 +112,7 @@ __attribute__((visibility("default"))) void *malloc(size_t size) {
112112
__attribute__((visibility("default"))) void *calloc(size_t nmemb, size_t size) {
113113
void *result = __libc_calloc(nmemb, size);
114114
size_t allocated = nmemb * size;
115-
if (allocated > 1000 && !will_i_be_reentrant && initialized) {
115+
if (!will_i_be_reentrant && initialized) {
116116
will_i_be_reentrant = 1;
117117
add_allocation_hook((size_t)result, allocated);
118118
will_i_be_reentrant = 0;

memapi/src/memorytracking.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl AllocationTracker {
6464
let alloc = Allocation { callstack, size };
6565
self.current_allocations.insert(address, alloc);
6666
self.current_allocated_bytes += size;
67-
if self.current_allocated_bytes > self.peak_allocated_bytes {
67+
if self.current_allocated_bytes > self.peak_allocated_bytes + 10000 {
6868
self.peak_allocated_bytes = self.current_allocated_bytes;
6969
self.peak_allocations = self.current_allocations.clone();
7070
}

0 commit comments

Comments
 (0)