Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.
/ deblockator Public archive

A global allocator to wrap fixed size block allocators

License

Notifications You must be signed in to change notification settings

vita-rust/deblockator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

deblockator

A platform-agnostic memory allocator designed for block allocators.

TravisCI Codecov Source CargoMake Changelog Crate Documentation

Introduction

The PS Vita provides a kernel API that allows to allocate memory blocks in the console RAM. However, the kernel will only ever allocate blocks of 4kB-aligned memory. While the VitaSDK newlib port uses a 32MB sized heap in a single memory block, it is not the most efficient to do so considering there is a proper allocator available.

The deblockator allocator relies on another allocator to obtain data blocks, and then uses a classic linked-list approachs to provide smaller memory chunks within those blocks. This allows growing a virtually infinite heap without needing to preallocate a large block on startup.

Usage

Add this crate to Cargo.toml:

[dependencies.deblockator]
git = "https://github.com/vita-rust/deblockator"

PS Vita

You'll need to have the armv7-vita-eabihf target specification in your $RUST_TARGET_PATH. If you don't have it, you can find in its dedicated git repository.

When compiling for the PS Vita, use the Vitallocator struct from the vitallocator crate and wrap it within the Deblockator struct:

#![feature(global_allocator)]
extern crate deblockator;
extern crate vitallocator;

use deblockator::Deblockator;
use vitallocator::Vitallocator;

#[global_allocator]
static ALLOC: Deblockator = Deblockator::new(Vitallocator::new());

Compiling to the PS Vita requires the psp2-sys crate.

Credits

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •