[PATCH] D17431: [Windows] Fix UnmapOrDie and MmapAlignedOrDie

Alexey Samsonov via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 22 11:29:01 PST 2016


samsonov accepted this revision.
samsonov added a comment.
This revision is now accepted and ready to land.

Looks reasonable (yet sad).


================
Comment at: lib/sanitizer_common/sanitizer_win.cc:141
@@ +140,3 @@
+  int retries = 0;
+  while (mapped_addr == 0 || !IsAligned(mapped_addr, alignment)) {
+    // Fail if we can't make this work quickly.
----------------
Consider

  const int kMaxRetries = 10;
  for (int retries = 0; retries < kMaxRetries && (mapped_addr == 0 || !IsAligned(mapped_addr, alignment); retries++) { ... }
  if (retries == kMaxRetries)
    ReportMmapFailureAndDie(size, mem_type, "allocate aligned", "too many retries");
  return (void*)mapped_addr;



http://reviews.llvm.org/D17431





More information about the llvm-commits mailing list