Skip to content
This repository was archived by the owner on Aug 16, 2021. It is now read-only.

Does this library allocate? #37

Closed
lilith opened this issue Sep 10, 2016 · 6 comments
Closed

Does this library allocate? #37

lilith opened this issue Sep 10, 2016 · 6 comments

Comments

@lilith
Copy link

lilith commented Sep 10, 2016

I'm wondering if this is suitable for representing errors in a potential out-of-memory condition (i.e. malloc failure)?

@brson
Copy link
Contributor

brson commented Sep 13, 2016

Yes, this library allocates in the chain_err method. Putting the "chained errors" into boxes on the heap is one of the primary tradeoffs it makes.

@lilith
Copy link
Author

lilith commented Sep 14, 2016

Would there be any way to create or mark an error to prevent allocations? I.e, if I'm manually handling OOM conditions, but want to represent the result as an Error, can I do so without allocs?

Clarification: I wouldn't expect any behavior other than a generic error with no metadata; I would also expect chain_error to discard anything provided.

Yamakaky added a commit that referenced this issue Nov 19, 2016
@Yamakaky
Copy link
Contributor

Closing for #64

@lilith
Copy link
Author

lilith commented Dec 5, 2016

My use case is runtime-based, i.e, I'd like chain_error functionality except for one class of origin error. I think the compile-time feature is awesome, though.

I should probably private-fork error_chain given the particular requirements of my lib and try to figure out a way to make this work. Thanks for the feedback!

@Yamakaky
Copy link
Contributor

Yamakaky commented Dec 5, 2016

It could help others. Do you have any idea how we should change the syntax?

@lilith
Copy link
Author

lilith commented Dec 5, 2016

I haven't done any exploratory work, no. I'm a few days off from refactoring error handling in my lib.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants