memkit-bevy
Bevy ECS integration for the memkit ecosystem.
Version: 0.1.0-alpha.1
Overview
memkit-bevy provides seamless integration between memkit and the Bevy game engine. It automatically manages frame lifecycle and exposes the allocator as a Bevy resource.
Features
- Automatic Frame Lifecycle — Frame begin/end tied to Bevy's
First/Lastschedules - Resource Integration —
MkAllocatorResas a BevyResource - System Sets —
MkSystemSet::FrameBeginandMkSystemSet::FrameEndfor ordering - Zero Configuration — Just add the plugin and go
- Optional Prelude — Enable
bevy_preludefeature for full Bevy re-exports
Quick Start
use *;
use ;
Custom Configuration
use MkConfig;
use MkPlugin;
// Option 1: Custom config
let config = MkConfig ;
new
.add_plugins
.run;
// Option 2: Just set arena size
new
.add_plugins // 64 MB
.run;
System Ordering
memkit-bevy provides system sets for proper ordering:
use ;
new
.add_plugins
// Run after frame begins
.add_systems
// Run before frame ends
.add_systems
.run;
Allocation Methods
Feature Flags
| Feature | Description |
|---|---|
bevy_prelude |
Re-exports bevy::prelude::* for convenience |
Types
| Type | Description |
|---|---|
MkPlugin |
Bevy plugin for memkit integration |
MkAllocatorRes |
Bevy resource wrapping MkAllocator |
MkSystemSet |
System sets for frame lifecycle ordering |
Compatibility
| memkit-bevy | Bevy |
|---|---|
| 0.12.x | 0.17.x |
How It Works
- Frame Begin (
Firstschedule): CallsMkAllocator::begin_frame() - Your Systems (
Update, etc.): UseRes<MkAllocatorRes>for frame allocations - Frame End (
Lastschedule): CallsMkAllocator::end_frame(), resetting the arena
All frame allocations are automatically freed when the frame ends — no manual cleanup needed.
License
This project is licensed under the Mozilla Public License 2.0 - see the LICENSE.md file for details.