Skip to content

Prost support (i.e. #[global_allocator] or arena allocator) #13

@tarcieri

Description

@tarcieri

We'd like to use Protocol Buffers as the serialization format for our "APDUs".

Prost provides a pure Rust implementation of the format, and Prost v0.6 upgraded to bytes v0.5, which added #![no_std] + liballoc support. There's an open PR to add #![no_std] + liballoc to Prost as well:

https://github.com/danburkert/prost/pull/215

If that lands, the simplest option for supporting Prost would be to use liballoc and define a #[global_allocator]. However, bytes was also refactored to (but does not yet fully support / expose) customizable vtables as the backing storage:

tokio-rs/bytes#298

This should allow it to support to support e.g. arena allocators. Since we're trying to support a simple APDU-like RPC protocol (possibly with interrupts and fixed-N concurrent requests), we could probably get by with a very simple arena allocator like [bumpalo](https://github.com/fitzgen/bumpalo (although looks like bumpalo needs liballoc too), since we'd always reclaim all of the allocated memory when a request completes, which seems like it might be a better fit for an RTFM environment (especially if we did eventually want to hit certain realtime deadlines).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions