-
Notifications
You must be signed in to change notification settings - Fork 9
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
AllocError
does not store additional information
#106
Comments
Not a trait, but associated type. The error type for collections' The main questions then are
Plus, for the majority of cases, allocators won't have any context to provide beyond just the size of the requested allocation, which shouldn't be part of the error type in order to avoid the performance overhead in the typically very hot code. Plus, by construction, this wouldn't be available to anything using the global allocator. The utility of custom errors is marginal due to that. |
@Zymlex Out of interest: What additional information are you thinking about? What is your context for that? I am recently thinking about this a lot in the context of safety-critical software. |
At least the error details. In cases where the data size is unknown, necessary to allocate space for a future error in advance (on application launch). It would be nice if it were possible to specify whether this feature is enabled and how much memory to allocate in advance. |
Thanks. You might want to have a look into the previous discussion about an associated error type #23. It kind of ended in "sounds generally interesting, but no one has a concrete usecase" (see #23 (comment)). |
In terms of use-cases, I would like to remove From what I've seen, most OOM handlers only care about size, and even then only as an FYI to print it as a potential clue for analyzing an OOM abort. Use-cases for including But one-size-fits-all I can imagine users adding verbose information to allocation errors in debug or beta-testing builds, and switching it to zero-sized types for production builds. Having a custom type for errors would make it possible, instead of |
QuestDB developer here. We're beginning to compile with nightly specifically for the availability of allocators. Traking details in the allocation error would be very very useful indeed. I'll provide some context, in hopes it can be of use. A database needs to continue working, even when it's close to running out of memory. The way we achieve this is by internally tracking how much memory we've allocated from the global allocator in an atomic counter. We then calculate a soft limit that we avoid To do this, we're using multiple dedicated allocators, one per database component (querying, data ingestion, data compaction, etc). When things fail we want to track details of what went wrong:
Our current hacky work-around is to place these details in a thread local and take its contents when we map the The thread local hack also relies on our code not being async. We have parts of the code that use async as well. It'll get even messier there. I wonder if the |
It would be nice if
AllocError
became a trait (or associated type) for which each implementation could add additional information, such as the cause of the error and something else.The text was updated successfully, but these errors were encountered: