Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make possible to use alloc feature with a custom allocator #39

Open
leighmcculloch opened this issue May 4, 2022 · 2 comments
Open

Comments

@leighmcculloch
Copy link
Member

Similar to #38 there's value in us providing use of this lib in situations where alloc isn't available or the heap isn't ideal to use.

This isn't urgent to do now, but something that would be nice to do.

@leighmcculloch
Copy link
Member Author

Two challenges with this:

  • Recursive types like ClaimPredicate currently use the Box type. We might be able to use the heapless pooled Box type instead. Or maybe we drop any type containing recursion, or replace the use of the type with some other type like ClaimPredicateNoRecursion. Or maybe we generate unique types up to some depth where the final depth has nothing.

  • Variable length arrays are Vec types under the hood. We could allocate fixed length arrays at the max length of the variable length type and use them instead. That's pretty simple, and heapless has a type we can use for that too. There is one additional challenge that our XDR contains unbounded variable length arrays and these realistically can't be allocated at u32::MAX. We'd need to provide some max capacity and hope for the best. Alternatively we just drop any type with a variable length field.

This was referenced May 4, 2022
@leighmcculloch leighmcculloch changed the title Make possible to use without alloc/heap Make possible to use alloc feature with a custom allocator May 13, 2022
@leighmcculloch
Copy link
Member Author

As a follow on from #44, this issue is being repurposed to change the alloc feature so it is possible to use the default global allocator, or provide your own allocator.

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

No branches or pull requests

2 participants
@leighmcculloch and others