Add Leak Detection to Ona Heap Allocator #15
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue