defer in alloc

This commit is contained in:
Able 2024-11-24 12:43:15 -06:00
parent 8b2b50e433
commit 8c88c0b5ae
2 changed files with 4 additions and 2 deletions

View file

@ -28,6 +28,8 @@ The policy on magic numbers is make them const and have a comment above them. Ty
This helps cut down on magic numbers while making acceptable names and atleast half assed documentation.
Constants are inlined anyways, so its the same thing in the binary.
```rust
// The standard vga port is mapped at 0xB8000
$VGA_PTR := 0xB8000

View file

@ -15,6 +15,7 @@ main := fn(): void {
// alloc.deinit()
balloc := allocators.BlockAlloc.init()
defer balloc.deinit()
bstruct := balloc.alloc(AStruct, 2)
if bstruct.ptr == null {
log.info("Hi\0")
@ -23,6 +24,5 @@ main := fn(): void {
log.info("Allocator functioned.\0")
}
// balloc.dealloc(bstruct_ptr, AStruct, 2)
// balloc.deinit()
return
}