class AllocChecker
Defined at line 32 of file ../../zircon/system/ulib/fbl/include/fbl/alloc_checker.h
An object which is passed to operator new to allow client code to handle
allocation failures. Once armed by operator new, the client must call `check()`
to verify the state of the allocation checker before it goes out of scope.
Use it like this:
AllocChecker ac;
MyObject* obj = new (
&ac
) MyObject();
if (!ac.check()) {
// handle allocation failure (obj will be null)
}
Public Methods
void AllocChecker ()
Defined at line 34 of file ../../zircon/system/ulib/fbl/include/fbl/alloc_checker.h
void ~AllocChecker ()
Defined at line 35 of file ../../zircon/system/ulib/fbl/include/fbl/alloc_checker.h
void arm (size_t size, bool result)
Arm the AllocChecker. Once armed, `check` must be called prior to destruction.
Defined at line 42 of file ../../zircon/system/ulib/fbl/include/fbl/alloc_checker.h
void arm (size_t size, bool result)
Arm the AllocChecker. Once armed, `check` must be called prior to destruction.
Defined at line 42 of file ../../zircon/system/ulib/fbl/include/fbl/alloc_checker.h
void arm (size_t size, bool result)
Arm the AllocChecker. Once armed, `check` must be called prior to destruction.
Defined at line 42 of file ../../zircon/system/ulib/fbl/include/fbl/alloc_checker.h
template <auto& result>
void arm (size_t size, const auto & result)
Allow calls with anything explicitly convertible to bool, not just
anything implicitly convertible to bool. This makes smart-pointer types
usable directly as the second argument.
Defined at line 53 of file ../../zircon/system/ulib/fbl/include/fbl/alloc_checker.h
template <auto& result>
void arm (size_t size, const auto & result)
Allow calls with anything explicitly convertible to bool, not just
anything implicitly convertible to bool. This makes smart-pointer types
usable directly as the second argument.
Defined at line 53 of file ../../zircon/system/ulib/fbl/include/fbl/alloc_checker.h
template <auto& result>
void arm (size_t size, const auto & result)
Allow calls with anything explicitly convertible to bool, not just
anything implicitly convertible to bool. This makes smart-pointer types
usable directly as the second argument.
Defined at line 53 of file ../../zircon/system/ulib/fbl/include/fbl/alloc_checker.h
bool check ()
Return true if the previous allocation succeeded.
Defined at line 56 of file ../../zircon/system/ulib/fbl/include/fbl/alloc_checker.h