Skip to content

refactor: api and impl - #4

Merged
ZR233 merged 19 commits into
mainfrom
dev-v03
Apr 9, 2026
Merged

refactor: api and impl#4
ZR233 merged 19 commits into
mainfrom
dev-v03

Conversation

@ZR233

@ZR233 ZR233 commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

No description provided.

ZR233 added 19 commits April 7, 2026 20:02
- Consolidated slab allocator benchmarks into a single file, removing redundant code and improving organization.
- Removed the stability.rs file, which contained stress tests that are now integrated into the stress_test.rs file.
- Introduced a new stress_test.rs file to handle various stress scenarios, including random mixed allocations, exhaustion recovery, and fragmentation recovery.
- Updated README.md to reflect changes in the test structure and added instructions for running stress tests.
- Removed the test_composite_page_allocator_alloc_at function from integration_test.rs as it was not providing meaningful validation.
- Introduced a MockOs struct to simulate CPU context switching in tests.
- Updated integration tests to use the new MockOs for cross-CPU allocation and deallocation scenarios.
- Refactored memory allocation and deallocation functions for better clarity and reuse.
- Enhanced stress tests to utilize the MockOs for simulating multi-CPU environments.
- Improved error handling and assertions in tests to ensure robustness.
- Removed redundant code and comments for cleaner test files.
- Updated integration tests to use BuddyAllocator and SlabAllocator.
- Replaced MockOs with TestOs for better clarity in test context.
- Simplified memory allocation and deallocation functions.
- Enhanced test cases for buddy allocator, including basic allocation, alignment, exhaustion recovery, and fragmentation recovery.
- Improved stress tests to ensure allocator stability and recovery from exhaustion.
- Removed unused code and comments for better readability.
…alization

- Updated benchmarks in `benches/slab_allocator.rs` to use the `divan` framework, simplifying the allocation and deallocation logic.
- Removed redundant code and improved clarity in benchmark functions for size class allocation, hot reuse, mixed size batch, and steady state recycling.
- Enhanced the `GlobalAllocator` in `src/global.rs` to manage metadata layout more effectively, ensuring proper alignment and size calculations.
- Modified the `BuddyAllocator` to enforce stricter checks during deallocation, ensuring that the correct block sizes are freed.
- Improved error handling in tests to validate allocator behavior under various conditions, including unaligned region starts and insufficient managed pages.
- Cleaned up memory allocation and deallocation logic in stress tests, removing unnecessary metadata handling.
…ees and add integration tests for cross-CPU deallocation
- Removed the MockOs struct and its implementation, simplifying the test setup.
- Introduced HostRegion for managing heap memory in tests.
- Updated allocation and deallocation logic to use usize pointers instead of NonNull.
- Added multithreaded stress tests for mixed allocation/freeing, remote freeing, page allocation/freeing, fragmentation recovery, and exhaustion recovery.
- Enhanced assertions to check for recovery with cached slabs.
- Improved random allocation logic and CPU management in tests.
- Introduced `BuddySection` and `ManagedSection` to manage multiple memory regions.
- Updated `GlobalAllocator` to compute and manage metadata for multiple sections.
- Modified allocation and deallocation methods to work with sections.
- Enhanced tests to validate behavior with multiple regions, including allocation, deallocation, and memory management.
- Added stress tests for concurrent allocation and region addition.
…ersion bump to 0.3.0

refactor: improve import order and formatting across benchmark and test files
@ZR233
ZR233 merged commit d0a93fb into main Apr 9, 2026
12 checks passed
@ZR233
ZR233 deleted the dev-v03 branch April 9, 2026 03:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant