Pages: [1]   Go Down
Author Topic: Dynamic memory debugging  (Read 154 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Last week, I was debugging some (seemingly) dynamic memory related problems (e.g., malloc, realloc and free). For this, I wrote some code to log all memory (de)allocations to Serial, and a script to analyze the results. In case it is useful for someone else as well, I've published the code on my blog:

Global Moderator
Offline Offline
Shannon Member
Karma: 168
Posts: 12428
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

think it is useful for the tech savvy.

What you could do is to also check the value of (p-2) as there the length of the allocated block is stored IIRC.
p = malloc(n) ==>  [ length] [address where p points to] [... additional bytes]


Rob Tillaart

Nederlandse sectie -,77.0.html -
(Please do not PM for private consultancy)

Pages: [1]   Go Up
Jump to: