authorgravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2022-06-23 17:02:29-07:00
committergravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2022-06-23 17:02:29-07:00
logdef304a9a5b9d001e37c19509a9d2b2450088033
tree8bbad07aa3d5b0d614caf2e4609a686a8c44de80
parent819e0e83d338a898f06d1e39c21da812ac58238b

Integrate FailingAllocator stack trace with testing.checkAllAllocationFailures


1 files changed, 2 insertions(+), 1 deletions(-)

lib/std/testing.zig+2-1
...@@ -650,7 +650,7 @@ pub fn checkAllAllocationFailures(backing_allocator: std.mem.Allocator, comptime...@@ -650,7 +650,7 @@ pub fn checkAllAllocationFailures(backing_allocator: std.mem.Allocator, comptime
650 error.OutOfMemory => {650 error.OutOfMemory => {
651 if (failing_allocator_inst.allocated_bytes != failing_allocator_inst.freed_bytes) {651 if (failing_allocator_inst.allocated_bytes != failing_allocator_inst.freed_bytes) {
652 print(652 print(
653 "\nfail_index: {d}/{d}\nallocated bytes: {d}\nfreed bytes: {d}\nallocations: {d}\ndeallocations: {d}\n",653 "\nfail_index: {d}/{d}\nallocated bytes: {d}\nfreed bytes: {d}\nallocations: {d}\ndeallocations: {d}\nallocation that was made to fail: {s}",
654 .{654 .{
655 fail_index,655 fail_index,
656 needed_alloc_count,656 needed_alloc_count,
...@@ -658,6 +658,7 @@ pub fn checkAllAllocationFailures(backing_allocator: std.mem.Allocator, comptime...@@ -658,6 +658,7 @@ pub fn checkAllAllocationFailures(backing_allocator: std.mem.Allocator, comptime
658 failing_allocator_inst.freed_bytes,658 failing_allocator_inst.freed_bytes,
659 failing_allocator_inst.allocations,659 failing_allocator_inst.allocations,
660 failing_allocator_inst.deallocations,660 failing_allocator_inst.deallocations,
661 failing_allocator_inst.getStackTrace(),
661 },662 },
662 );663 );
663 return error.MemoryLeakDetected;664 return error.MemoryLeakDetected;