diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2006-07-31 15:23:00 +0000 |
---|---|---|
committer | Erik Schnetter <schnetter@cct.lsu.edu> | 2006-07-31 15:23:00 +0000 |
commit | e5a8a21b89da0b36aab3a4da5acf2a9e3404ab4b (patch) | |
tree | 62799c10cdac2d09de807d44b66aab0610c00291 /Carpet/CarpetLib/src/mem.cc | |
parent | ddaf9c83319d4e05a8daace74116dddfb03f4cd6 (diff) |
CarpetLib: Poison newly allocated memory if desired
Poison newly allocated memory if desired. This is potentially more
thorough that Carpet's poisoning, since it is applied to all allocated
memory. It is not applied after time level cycling, though, so it
cannot replace Carpet's poisoning.
darcs-hash:20060731152325-dae7b-d039ee958161690c9430e70a8051d400273b819e.gz
Diffstat (limited to 'Carpet/CarpetLib/src/mem.cc')
-rw-r--r-- | Carpet/CarpetLib/src/mem.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Carpet/CarpetLib/src/mem.cc b/Carpet/CarpetLib/src/mem.cc index 5b54d61ac..0f4c3ac06 100644 --- a/Carpet/CarpetLib/src/mem.cc +++ b/Carpet/CarpetLib/src/mem.cc @@ -70,6 +70,9 @@ mem (size_t const vectorlength, size_t const nelems, T * const memptr) try { storage_ = new T [vectorlength * nelems]; owns_storage_ = true; + if (poison_new_memory) { + memset (storage_, poison_value, vectorlength * nelems * sizeof (T)); + } } catch (...) { T Tdummy; CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING, |