The invention relates to a method and apparatus of simulating memory
allocation errors in a software application. The method includes:
determining a range of memory block sizes in a memory allocation function
which results in a memory allocation failure, the range of memory block
sizes defined by a first simulation criteria and including all memory
block sizes between a minimum threshold and a maximum threshold;
initializing an application, and simultaneously executing the memory
allocation function; triggering a memory allocation failure if the
application requires a memory value within the range of memory block
sizes; and varying the range of memory block sizes based on a second
simulation criteria, wherein the first simulation criteria and second
simulation criteria are determined by a pre-determined range of memory
block sizes for a memory failure simulation.