mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-08-25 16:54:47 +03:00
wip: initial work on tracking source of an allocation in debug mode
This commit is contained in:
parent
0a77b7423f
commit
4090561975
10 changed files with 381 additions and 164 deletions
|
@ -23,10 +23,12 @@ public:
|
|||
~Test() { }
|
||||
};
|
||||
|
||||
void dangling_ptr_write();
|
||||
|
||||
int main() {
|
||||
mi_stats_reset(); // ignore earlier allocations
|
||||
atexit(free_p);
|
||||
dangling_ptr_write();
|
||||
void* p1 = malloc(78);
|
||||
void* p2 = mi_malloc_aligned(16,24);
|
||||
free(p1);
|
||||
|
@ -53,6 +55,14 @@ int main() {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void dangling_ptr_write() {
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
uint8_t* p = new uint8_t[16];
|
||||
free(p);
|
||||
p[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
class Static {
|
||||
private:
|
||||
void* p;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue