Stream: t-libs/wg-allocators

Topic: The Alloc trait


Tim Diekmann (May 03 2019 at 17:50, on Zulip):

I want to bring back the discussion about modifying the Alloc trait.

In #58457 there were several suggestions, on how to change/improve the Alloc trait:

Simon Sapin (May 03 2019 at 18:08, on Zulip):

It’d be good to carefully go through past discussions (there are some in internals.rlo too) and file specific issues in the new repo about everything that is not resolved or implemented yet. @Tim Diekmann, would you like to do that?

Tim Diekmann (May 03 2019 at 18:11, on Zulip):

Yup, I'll do that. Just to make sure I understood you right: not resolved means things like mentioned above and not implemented means things like Vec<T, A>, hashbrown::HashMap<T, A>, Box<T, A> etc.?

Simon Sapin (May 03 2019 at 18:18, on Zulip):

It’s a bit fuzzy, but in my mind “not resolved” means that a change was proposed but no consensus was reached (either because of disagreement or because the discussion just died off). “Not implemented” is when there’s consensus of yes we should totally do X, but no one made the PR

Tim Diekmann (May 03 2019 at 18:24, on Zulip):

Alright. I'll start with a list of structs, which are the goal of this WG. Then I'll search through the dozens of topics on github and internals.rlo for suggestions, discussions etc. and make different issues where needed.

Simon Sapin (May 03 2019 at 18:27, on Zulip):

List of what structs?

Tim Diekmann (May 03 2019 at 18:27, on Zulip):

This so far:

Simon Sapin (May 03 2019 at 18:32, on Zulip):

ah, that should gain an allocator parameter

Tim Diekmann (May 03 2019 at 18:33, on Zulip):

Yeah, thanks :sweat_smile:

Simon Sapin (May 03 2019 at 18:34, on Zulip):

hashbrown will be an “interesting” case, since the crates.io copy supports stable

Tim Diekmann (May 03 2019 at 18:35, on Zulip):

Yup, I also thought this. But currently this is out of scope I guess.

Simon Sapin (May 03 2019 at 18:37, on Zulip):

Once more of the pieces are in place we can see what approach Amanieu wants to take

Tim Diekmann (May 03 2019 at 18:45, on Zulip):

@Simon Sapin You may want to add some Labels to the repository? Especially for suggestions, discussions and tracking issues this would make sense.

Tim Diekmann (May 03 2019 at 18:46, on Zulip):

Oh, I cannot assign labels anyway :blush:

Simon Sapin (May 03 2019 at 19:00, on Zulip):

I’m not sure what the labels should be

Simon Sapin (May 03 2019 at 19:00, on Zulip):

You should have an invite for the repo

Tim Diekmann (May 03 2019 at 19:22, on Zulip):

Thanks, I'll put in some love soon

Scott J Maddox (May 03 2019 at 23:07, on Zulip):

There's also this comment which gives some more context and a more complete example. I really hope this use case is not forgotten. There are many custom allocators that depend on this kind of behavior (i.e. finding the allocator state from allocated pointer addresses).

As for Dealloc, it would complicate the Box and Vec implementations a bit (separating each function based on if it needs access to Dealloc or Dealloc+Alloc), but it might be worth it to eke out the last bit of performance for specialized allocators. If deallocation is a no-op, for example, you want the compiler to throw away all code to access the Alloc instance; it might have trouble doing that in some cases, though, but it might be made easier if it's only Dealloc. I don't know, though. It's just speculation.

Tim Diekmann (May 03 2019 at 23:10, on Zulip):

@Scott J Maddox I'm currently on tracking the open discussions at github. If you don't mind you may file an issue at https://github.com/rust-lang/wg-allocators?

Mike Hommey (May 03 2019 at 23:11, on Zulip):

@Scott J Maddox the link doesn't work

Mike Hommey (May 03 2019 at 23:11, on Zulip):

https://github.com/rust-lang/wg-allocators/issues/9 is related, presumably

Scott J Maddox (May 03 2019 at 23:11, on Zulip):

Scott J Maddox the link doesn't work

Hmm... That's odd. It works for me..

Tim Diekmann (May 03 2019 at 23:12, on Zulip):

https://github.com/rust-lang/rust/pull/58457#issuecomment-475089881

Scott J Maddox (May 03 2019 at 23:12, on Zulip):

Oh, you mean the quoted one. I'll fix it.

Tim Diekmann (May 03 2019 at 23:12, on Zulip):

Zulip added "quote" ;)

Scott J Maddox (May 04 2019 at 00:17, on Zulip):

Scott J Maddox I'm currently on tracking the open discussions at github. If you don't mind you may file an issue at https://github.com/rust-lang/wg-allocators?

Opened https://github.com/rust-lang/wg-allocators/issues/12

Tim Diekmann (May 04 2019 at 00:23, on Zulip):

Thanks for filing this. Also thanks for the link to the example, now I really understand why you came up with this approach. We may need to bikeshed about the name, but this is another story. BuildAlloc would be analogous to BuildHasher for example.

Last update: Nov 15 2019 at 10:25UTC