[XRay] Account for virtual memory re-use
authorDean Michael Berris <dberris@google.com>
Mon, 22 Oct 2018 06:11:50 +0000 (06:11 +0000)
committerDean Michael Berris <dberris@google.com>
Mon, 22 Oct 2018 06:11:50 +0000 (06:11 +0000)
Change the assumption when releasing memory to a buffer queue that new
generations might not be able to re-use the memory mapped addresses.

llvm-svn: 344882

compiler-rt/lib/xray/xray_buffer_queue.cc

index fd41e5f..35d875a 100644 (file)
@@ -124,13 +124,11 @@ BufferQueue::ErrorCode BufferQueue::releaseBuffer(Buffer &Buf) {
       return BufferQueue::ErrorCode::UnrecognizedBuffer;
     }
 
-    // This points to a semantic bug, we really ought to not be releasing more
-    // buffers than we actually get.
     if (LiveBuffers == 0) {
       Buf.Data = nullptr;
       Buf.Size = Buf.Size;
       Buf.Generation = 0;
-      return ErrorCode::NotEnoughMemory;
+      return ErrorCode::Ok;
     }
 
     --LiveBuffers;