| ... | @@ -341,9 +341,15 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { | ... | @@ -341,9 +341,15 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { |
| 341 | const slot_index = @intCast(SlotIndex, used_bits_byte * 8 + bit_index); | 341 | const slot_index = @intCast(SlotIndex, used_bits_byte * 8 + bit_index); |
| 342 | const stack_trace = bucketStackTrace(bucket, size_class, slot_index, .alloc); | 342 | const stack_trace = bucketStackTrace(bucket, size_class, slot_index, .alloc); |
| 343 | const addr = bucket.page + slot_index * size_class; | 343 | const addr = bucket.page + slot_index * size_class; |
| 344 | log.err("memory address 0x{x} leaked: {s}", .{ | 344 | if (builtin.zig_backend == .stage1) { |
| 345 | @ptrToInt(addr), stack_trace, | 345 | log.err("memory address 0x{x} leaked: {s}", .{ |
| 346 | }); | 346 | @ptrToInt(addr), stack_trace, |
| | 347 | }); |
| | 348 | } else { // TODO |
| | 349 | log.err("memory address 0x{x} leaked", .{ |
| | 350 | @ptrToInt(addr), |
| | 351 | }); |
| | 352 | } |
| 347 | leaks = true; | 353 | leaks = true; |
| 348 | } | 354 | } |
| 349 | if (bit_index == math.maxInt(u3)) | 355 | if (bit_index == math.maxInt(u3)) |
| ... | @@ -372,9 +378,16 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { | ... | @@ -372,9 +378,16 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { |
| 372 | var it = self.large_allocations.valueIterator(); | 378 | var it = self.large_allocations.valueIterator(); |
| 373 | while (it.next()) |large_alloc| { | 379 | while (it.next()) |large_alloc| { |
| 374 | if (config.retain_metadata and large_alloc.freed) continue; | 380 | if (config.retain_metadata and large_alloc.freed) continue; |
| 375 | log.err("memory address 0x{x} leaked: {s}", .{ | 381 | const stack_trace = large_alloc.getStackTrace(.alloc); |
| 376 | @ptrToInt(large_alloc.bytes.ptr), large_alloc.getStackTrace(.alloc), | 382 | if (builtin.zig_backend == .stage1) { |
| 377 | }); | 383 | log.err("memory address 0x{x} leaked: {s}", .{ |
| | 384 | @ptrToInt(large_alloc.bytes.ptr), stack_trace, |
| | 385 | }); |
| | 386 | } else { // TODO |
| | 387 | log.err("memory address 0x{x} leaked", .{ |
| | 388 | @ptrToInt(large_alloc.bytes.ptr), |
| | 389 | }); |
| | 390 | } |
| 378 | leaks = true; | 391 | leaks = true; |
| 379 | } | 392 | } |
| 380 | return leaks; | 393 | return leaks; |