Skip to content

Releases: jfrimmel/emballoc

Version 0.3.0

17 Sep 18:05
15e6ad1
Compare
Choose a tag to compare

This minor release reduces the memory footprint of the allocator! Thanks @stephan-gh for reporting this issue and testing the fixes!

The problem

Previous versions of this crate immediately initialized the "heap" array with a non-zero value in the first few bytes. This causes the entire array backing the allocator being marked as "initialized with non-zero values" and thus being placed in the .data-section. The .data-section, containing non-zero initialization data, needs to be initialized on device startup. This is done by storing the initialization data in the flash and copying them to the RAM in startup. While this is fine in general, this poses a problem in this crate:
If a user creates an 8kiB allocation heap, the first 4 bytes are actually initialized, but the whole 8kiB get added to the Flash size. This might be problematic in constrained environments.

Therefore the allocator will now lazily initialize the heap memory on the first allocation. The heap array remains uninitialized, except for the first few bytes, which are zeroed out. This solves the aforementioned problem.

Note, that this feature is on by default and not user-controllable. There should not be any noticeable performance differences (after all, it is only one additional if when allocating).

Update procedure

To update the crate, simply run (if you already depend on it):

$ cargo update -p emballoc

If you want to use this as a new dependency in your Rust project, just add the following snippet to your Cargo.toml

[dependencies]
emballoc = "0.3.0"

and register the emballoc::Allocator as the global allocator:

#[global_allocator]
static ALLOCATOR: emballoc::Allocator<4096> = emballoc::Allocator::new();

Version 0.2.0

10 Nov 12:00
Compare
Choose a tag to compare

This minor release adds support for previously unsupported platforms! Thanks @alistair23!

The problem

Previously one could not compile for platforms like an ARM Cortex-M0 (thumbv6m-none-eabi), because this platform (among a few others) does not include a required atomic instruction. Therefore the code did not compile:

compiler error

PR #32 adds support for this platforms with the caveats described in the spin-crate. One has to enable the new cargo-feature portable_atomic and also specify a signal, how the portable_atomic-crate should emulate the missing instructions. On single-core-systems one can pass a specific cfg (please consult the documentation of both spin and portable_atomic beforehand to prevent unsoundness):

working compilation

Update procedure

To update the crate, simply run (if you already depend on it):

$ cargo update -p emballoc

If you want to use this as a new dependency in your Rust project, just add the following snippet to your Cargo.toml

[dependencies]
emballoc = "0.2.0"

and register the emballoc::Allocator as the global allocator:

#[global_allocator]
static ALLOCATOR: emballoc::Allocator<4096> = emballoc::Allocator::new();

Version 0.1.3

09 Jul 19:28
Compare
Choose a tag to compare

This is a patch release for fixing this vulnerability. Thanks, @Dylan-DPC!

This release also lowers the minimum supported Rust version (MSRV) to 1.57.

To update the crate, simply run (if you already depend on it):

$ cargo update -p emballoc

If you want to use this as a new dependency in your Rust project, just add the following snippet to your Cargo.toml

[dependencies]
emballoc = "0.1.3"

and register the emballoc::Allocator as the global allocator:

#[global_allocator]
static ALLOCATOR: emballoc::Allocator<4096> = emballoc::Allocator::new();

Version 0.1.2

24 Aug 16:46
Compare
Choose a tag to compare

This release contains many improvements of the code documentation and extends the test coverage by setting up CircleCI and codecov.io publicly visible. It also makes the licensing more clear (the license hasn't changed, but its visibility is increased by mentioning it it the Readme and fixing the license information on GitHub). To update the crate, simply run (if you already depend on it):

$ cargo update -p emballoc

If you want to use this as a new dependency in your Rust project, just add the following snippet to your Cargo.toml

[dependencies]
emballoc = "0.1.2"

and register the emballoc::Allocator as the global allocator:

#[global_allocator]
static ALLOCATOR: emballoc::Allocator<4096> = emballoc::Allocator::new();

Version 0.1.1

21 Aug 15:10
Compare
Choose a tag to compare

This release contains many improvements of the code documentation and takes care of some missing information on crates.io. If you already depend on that crate, simply run

$ cargo update -p emballoc

If you want to use this as a new dependency in your Rust project, just add the following snippet to your Cargo.toml

[dependencies]
emballoc = "0.1.1"

and register the emballoc::Allocator as the global allocator:

#[global_allocator]
static ALLOCATOR: emballoc::Allocator<4096> = emballoc::Allocator::new();

Version 0.1.0

21 Aug 10:09
c3662ca
Compare
Choose a tag to compare

This release marks the first public release of this crate. It contains a minimal API and a basic working implementation. To use this crate, simply add it to your dependencies:

[dependencies]
emballoc = "0.1.0"

and register the emballoc::Allocator as the global allocator:

#[global_allocator]
static ALLOCATOR: emballoc::Allocator<4096> = emballoc::Allocator::new();