Skip to content

Conversation

patricoferris
Copy link
Contributor

@patricoferris patricoferris commented Aug 21, 2023

This is an experiment to switch away from Cstruct to Bstruct (bytes-backed Cstruct). The main issue is that the bytes are in the OCaml heap but we have to ensure they don't move. I started playing around with an allocator (Uring.Slab) which allocates a big bytes area upfront and the carves it up as the user requests slices (returned as Bstruct.t). For this to work properly the Uring.Slab implementation needs a few more tricky features:

  • The bytes array probably needs to be more dynamic so it can create other big bytes areas when there's a lot of requests for slices.
  • Slices that are finished with, should be garbage-collected which probably means having some reference counting.

Opening this PR in case other people want to have a play around. Note this will only work with OCaml 5+ and is related to ocaml-multicore/eio#140

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

Successfully merging this pull request may close these issues.

1 participant