[PATCH] D34782: [scudo] Change aligned alloc functions to be more compliant & perf changes

Aleksey Shlyapnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 29 08:59:20 PDT 2017


alekseyshl added inline comments.


================
Comment at: lib/scudo/scudo_allocator.cpp:676
+  }
   *MemPtr = Instance.allocate(Size, Alignment, FromMemalign);
   return 0;
----------------
cryptoad wrote:
> cryptoad wrote:
> > alekseyshl wrote:
> > > To follow the spec, we should check the result too:
> > > 
> > > if (!*MemPtr)
> > >   return errno_ENOMEM;
> > Yeah I wanted to talk to you about that.
> > Following what's in https://linux.die.net/man/3/malloc (look for ENOMEM) , we should probably set the errno in ReturnNullOrDieOnFailure::OnOOM (or whichever works better).
> I just realized there is no errno_ENOMEM. Do you know the reasoning behind having errno_E* as opposed to using the E* value itself?
Nope, I do not know the reason, and yes, you're right, we must set errno to ENOMEM in case of OOM (Windows expects the same, actually).


https://reviews.llvm.org/D34782





More information about the llvm-commits mailing list