Add Leak Detection to Ona Heap Allocator #15

Merged
kayomn merged 12 commits from ona-allocator-safety-tracker into main 2023-06-04 16:07:47 +02:00
1 changed files with 2 additions and 2 deletions
Showing only changes of commit d4fd1bfb43 - Show all commits

View File

@ -52,7 +52,7 @@ pub fn Stack(comptime Value: type) type {
return;
}
io.deallocate(allocator, self.values);
io.deallocate(allocator, self.values.ptr[0 .. self.capacity]);
self.values = &.{};
self.capacity = 0;
@ -132,7 +132,7 @@ pub fn Stack(comptime Value: type) type {
pub fn push_all(self: *Self, allocator: io.Allocator, values: []const Value) io.AllocationError!void {
const new_length = self.values.len + values.len;
if (new_length >= self.capacity) {
if (new_length > self.capacity) {
try self.grow(allocator, values.len + values.len);
}