Chromium Code Reviews| Index: third_party/tcmalloc/chromium/src/free_list.cc |
| =================================================================== |
| --- third_party/tcmalloc/chromium/src/free_list.cc (revision 101306) |
| +++ third_party/tcmalloc/chromium/src/free_list.cc (working copy) |
| @@ -64,10 +64,18 @@ |
| #include <stddef.h> |
| #include "internal_logging.h" //for ASSERT |
| +// TODO(jar): We should use C++ rather than a macro here. |
| #define MEMORY_CHECK(v1, v2) \ |
| if (v1 != v2) CRASH("Memory corruption detected.\n") |
| namespace { |
| +void EnusreNonLoop(void* node, void* next) { |
|
jschuh
2011/09/28 23:13:11
I think you meant EnsureNonLoop.
jar (doing other things)
2011/09/29 22:30:57
Done.
|
| + // We only have time to do minimal checking. We don't traverse the list, but |
| + // only look for an immediate loop (cycle back to ourself). |
| + if (node != next) return; |
| + CRASH("Circular loop in list detected: %p\n", next); |
| +} |
| + |
| // Returns value of the |previous| pointer w/out running a sanity |
| // check. |
| inline void *FL_Previous_No_Check(void *t) { |
| @@ -88,10 +96,12 @@ |
| } |
| inline void FL_SetPrevious(void *t, void *n) { |
| + EnusreNonLoop(t, n); |
| reinterpret_cast<void**>(t)[1] = n; |
| } |
| inline void FL_SetNext(void *t, void *n) { |
| + EnusreNonLoop(t, n); |
| reinterpret_cast<void**>(t)[0] = n; |
| } |