bounded-spsc-queue icon indicating copy to clipboard operation
bounded-spsc-queue copied to clipboard

Don't panic on OOM allocation

Open polyfractal opened this issue 8 years ago • 1 comments
trafficstars

Currently, if you try to request too much memory for the queue and allocation fails, we throw an OOM panic. That's pretty unfriendly :)

Instead, we should return a Result with the proper error so the user can decide what to do.

polyfractal avatar Jan 17 '17 09:01 polyfractal

Hi,

I ran into a similar issue, but on the other side of the allocation size ;)

If you want to send an empty struct across the queue, it dies with a memory allocation of 0 bytes failedAbort trap: 6. While this might not be a good use case, I think returning a result and telling the user rather than panicking might be better.

daschl avatar Feb 25 '19 07:02 daschl