build: fix alloc (#6) #11

Merged
Sweetbread merged 1 commits from sanyakapoor27/Core:fix/alloc into master 2026-03-20 10:45:39 +00:00
Contributor

While looking through the allocator I noticed a couple issues around
sector tracking and freeing logic.

So i made this PR to fix a few issues:

  • Initialize the MAIN_SECTOR table so we don't read uninitialized pointers
  • Store newly allocated sector addresses in the sector table
  • Use mutable references for SectorHeader so size_left updates persist
  • Ensure sys::free() is only called on sector base pointers
  • Avoid freeing block pointers returned to the user

These changes should make sector tracking work correctly and prevent
invalid frees when blocks are deallocated.

There are still a few things that could probably be improved later
(alignment handling, page rounding, and possibly block coalescing).
If this approach looks fine I can follow up with another PR for those.

While looking through the allocator I noticed a couple issues around sector tracking and freeing logic. So i made this PR to fix a few issues: - Initialize the MAIN_SECTOR table so we don't read uninitialized pointers - Store newly allocated sector addresses in the sector table - Use mutable references for SectorHeader so size_left updates persist - Ensure sys::free() is only called on sector base pointers - Avoid freeing block pointers returned to the user These changes should make sector tracking work correctly and prevent invalid frees when blocks are deallocated. There are still a few things that could probably be improved later (alignment handling, page rounding, and possibly block coalescing). If this approach looks fine I can follow up with another PR for those.
Owner

Did you try to compile something with this fix?

Did you try to compile something with this fix?
Author
Contributor

yes, tested my network example (sending a PR for that), and other examples present in the directory(con.rs)Screenshot 2026-03-15 112626.png

yes, tested my network example (sending a PR for that), and other examples present in the directory(`con.rs`)<img width="765" alt="Screenshot 2026-03-15 112626.png" src="attachments/70dd81f0-ffcd-4e0b-99d7-44370bfb849d">
Owner

HWA in production still doesn't work, but you did a good work. Can you change your email in the commit?

HWA in production still doesn't work, but you did a good work. Can you change your email in the commit?
sanyakapoor27 added 1 commit 2026-03-16 12:22:48 +00:00
sanyakapoor27 force-pushed fix/alloc from 5723950f42 to 96865ca251 2026-03-16 12:22:48 +00:00 Compare
Author
Contributor

sorry i missed that updated it

sorry i missed that updated it
Sweetbread changed title from build: fix alloc ( #6 ) to build: fix alloc (#6) 2026-03-16 13:51:41 +00:00
Sweetbread merged commit 77281bb836 into master 2026-03-20 10:45:39 +00:00
Sign in to join this conversation.