Index: src/zone.cc |
diff --git a/src/zone.cc b/src/zone.cc |
index 417f895e5ae29536cf29c4f7eb42344c57d55277..6e0c11d4596d19450c313f1598e5c03232c7e618 100644 |
--- a/src/zone.cc |
+++ b/src/zone.cc |
@@ -104,9 +104,13 @@ void Zone::DeleteAll() { |
} else { |
int size = current->size(); |
#ifdef DEBUG |
+#ifdef ADDRESS_SANITIZER |
+ // Un-poison first so the zapping doesn't trigger ASan complaints. |
+ ASAN_UNPOISON_MEMORY_REGION(current, size); |
+#endif // ADDRESS_SANITIZER |
// Zap the entire current segment (including the header). |
memset(current, kZapDeadByte, size); |
-#endif |
+#endif // DEBUG |
DeleteSegment(current, size); |
} |
current = next; |
@@ -120,6 +124,10 @@ void Zone::DeleteAll() { |
Address start = keep->start(); |
position_ = RoundUp(start, kAlignment); |
limit_ = keep->end(); |
+#ifdef ADDRESS_SANITIZER |
+ // Un-poison so we can re-use the segment later. |
+ ASAN_UNPOISON_MEMORY_REGION(start, keep->capacity()); |
+#endif |
#ifdef DEBUG |
// Zap the contents of the kept segment (but not the header). |
memset(start, kZapDeadByte, keep->capacity()); |
@@ -143,9 +151,13 @@ void Zone::DeleteKeptSegment() { |
if (segment_head_ != NULL) { |
int size = segment_head_->size(); |
#ifdef DEBUG |
+#ifdef ADDRESS_SANITIZER |
+ // Un-poison first so the zapping doesn't trigger ASan complaints. |
+ ASAN_UNPOISON_MEMORY_REGION(segment_head_, size); |
+#endif // ADDRESS_SANITIZER |
// Zap the entire kept segment (including the header). |
memset(segment_head_, kZapDeadByte, size); |
-#endif |
+#endif // DEBUG |
DeleteSegment(segment_head_, size); |
segment_head_ = NULL; |
} |