https://issues.dlang.org/show_bug.cgi?id=20813
Issue ID: 20813
Summary: std.experimental.allocator add fault injecting
allocator
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: enhancement
Priority: P1
Component: phobos
Assignee: [email protected]
Reporter: [email protected]
A feature request of adding an allocator building block that with a given
probability simply fails to allocate memory and returns null. Otherwise
allocate from the parent. Determination can be done using per-thread random
generator for example. Extra conditions (i.e. do different probabilities for
different sizes) can be done using other allocator building blocks.
As a bonus it might be useful in some cases to fail multiple consecutive calls
to allocate(), not just do it every 1000 calls. I.e. fail 3 calls to
allocate().
--