Expand description
Gharial
is a test tool for program to manipulate memory directly.
Rust usually follows the rule of RAII (Resource Acquisition is Initialization;) resources should be released on the drop, however, it is sometimes difficult to design low level code like that.
Container object, for example, sometimes allocates heap memory and build elements there. Then, the programmer could have to drop the elements and deallocate the heap manully; otherwise some trouble like memory leak could be occurred.
Gharial
helps to test such program.
Structs
MaybeAlloc
is an implementation for GlobalAlloc
, which occasionally fails to allocate.NeverAlloc
is an implementation for GlobalAlloc
, which always fails.
For example, NeverAlloc::alloc
always returns a null pointer.TestAlloc
is a implementation for GlobalAlloc
to test memory leak and so on.TestBox
behaves like std::boxed::Box
except for it owns a reference to a GlobalAlloc
.