Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upTracking issue for RFC #2116: fallible collection allocation #48043
Comments
aturon
added
B-RFC-approved
T-libs
C-tracking-issue
labels
Feb 7, 2018
This comment has been minimized.
This comment has been minimized.
|
Hi, this feature will require |
This comment has been minimized.
This comment has been minimized.
|
I can use some mentorship on what's the best way to implement oom=panic/abort . Should I emit a global variable through rustc depending on this case? I was taking inspiration from #32900 but there might be an easier way to emit a boolean global variable. |
whitequark
referenced this issue
Mar 5, 2018
Open
Handle out-of-memory errors during DMA sequence recording #945
This comment has been minimized.
This comment has been minimized.
|
cc @Gankro, can you help mentor? |
bors
added a commit
that referenced
this issue
Mar 9, 2018
bors
added a commit
that referenced
this issue
Mar 12, 2018
bors
added a commit
that referenced
this issue
Mar 12, 2018
snf
referenced this issue
Mar 12, 2018
Closed
AsmJS' malloc aborts on OOM instead of returning NULL #48968
bors
added a commit
that referenced
this issue
Mar 13, 2018
bors
added a commit
that referenced
this issue
Mar 14, 2018
bors
added a commit
that referenced
this issue
Mar 15, 2018
kennytm
referenced this issue
Mar 19, 2018
Open
Tracking issue for `unstable_name_collision` compatibility lint #48919
This comment has been minimized.
This comment has been minimized.
|
|
SimonSapin
referenced this issue
Apr 5, 2018
Merged
Add GlobalAlloc trait + tweaks for initial stabilization #49669
SimonSapin
referenced this issue
Apr 20, 2018
Closed
Tracking issue for the GlobalAlloc trait and related APIs #49668
This comment has been minimized.
This comment has been minimized.
We've been talking about panic::set_hook-like hooking for the new oom lang item in #49668, this could be how this works. |
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton, how does #51041 fit with the goal of implementing some way to opt into oom=panic? |
This comment has been minimized.
This comment has been minimized.
|
@SimonSapin we'd decide that the regression is acceptable, and we'd revert the change. |
This comment has been minimized.
This comment has been minimized.
|
You use a conditional tense, but |
This comment has been minimized.
This comment has been minimized.
|
Ok sure, we can figure it out in the implementation details? AFAIK there's no need to revert the change as it has basically no benefit today. It's a trivial change to revert as well, it's one line in the standard library |
This comment has been minimized.
This comment has been minimized.
3n-mb
commented
Jun 24, 2018
|
This example in playground asks for Is this RFC implementation is not at the point, at which errors in such cases will start to show up? |
This comment has been minimized.
This comment has been minimized.
|
When an error is returned is entirely dependent of the underlying allocator. As far as I know Linux usually overcommits, Windows doesn’t. https://play.rust-lang.org/?gist=aa668f38117983d1951b58307df04880&version=nightly allocates 120 PB but fails at 130 PB, it is exhausting 48 bits of address space. Even on Linux though, this API can be useful for 32-bit programs when exhausting the address space is much more realistic. |
SimonSapin
added
B-RFC-implemented
and removed
B-RFC-approved
labels
Jun 27, 2018
This comment has been minimized.
This comment has been minimized.
|
#43596 was the pre-RFC feature request for |
This comment has been minimized.
This comment has been minimized.
|
#52420 will change |
This comment has been minimized.
This comment has been minimized.
|
Will, or would. I’ve comment there that such a change in public API design merits being discussed separately from a large PR. |
This comment has been minimized.
This comment has been minimized.
|
Yeah definitely. Even if it weren't for the 2018 delaying considering these things, I wouldn't expect it to be merged quick. I just make the PR to prove the feasibility and make my ideas clearer to / interactive for others. Ignoring the benefits of allocator polymorphism itself (that would be #42774), I see 4 big benefits:
I thus advocating going with error polymorphism and abandoning |
This comment has been minimized.
This comment has been minimized.
|
Firefox needs Some of the discussion above is about
|
This comment has been minimized.
This comment has been minimized.
|
@SimonSapin Yes if things were done my way Firefox wouldn't be (There's also the more minor quibble that under the simplest version of my plan, the The libs team paused associated allocators to prioritize the 2018 edition. That's fine with me, but then I think it only fair that Firefox wait too. I promise as soon as the gates are open I'll rush to revive @glandium's and my PRs. |
This comment has been minimized.
This comment has been minimized.
|
Right,
It’s not about who gets candy first. RFC 2116 was submitted 14 months ago and accepted 8 months ago. The That said, there is no real urgency for |
This comment has been minimized.
This comment has been minimized.
|
Well it sounds like we are in something closer to agreement than usual. :)
The code has been written and if I recall correctly works (there was one ancillary issue with trying to make default impls work well, but it is not fundamental and I believe I found a workaround beyond just requiring more boilerplate). It just needs to be read and debated. |
This comment has been minimized.
This comment has been minimized.
|
@SimonSapin it's been awhile since I took a look at this, but is the idea that (in the long run) every fallible method on a collection returns One possible alternative to this is to avoid defining this type at all I think? For example unlike as we may have originally though I think I'd personally lean towards what you're thinking @SimonSapin by having |
This comment has been minimized.
This comment has been minimized.
|
Oh, I forgot that At the moment I don’t really have an opinion on whether
It looks like at least some of the code paths in Firefox track the size (and alignment) of the allocation request that failed, so the current enum might be insufficient anyway. Alright, on further thought it may not make sense to pursue this just yet, until we figure out the rest of the story for allocation traits and error types. |
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton So in https://github.com/rust-lang/rust/pull/52420/files I did make a Honestly, I'm not even sure All this another reason, and one I initially forgot (but now remember thinking of when I rebased my PR over |
This comment has been minimized.
This comment has been minimized.
|
I think this is a feature that we need semi-urgently. There are projects out there that require |
aturon commentedFeb 7, 2018
•
edited by SimonSapin
This is a tracking issue for the
try_reservepart of the RFC "fallible collection allocation" (rust-lang/rfcs#2116).Steps:
HashSet::try_reserve?API: