parsec icon indicating copy to clipboard operation
parsec copied to clipboard

zone_malloc should handle 0-sized allocations gracefully

Open devreal opened this issue 1 year ago • 1 comments

Describe the bug

If we pass zero as size to zone_malloc it will return NULL, which will be interpreted by kernel_push as an out-of-memory situation so the task will be trapped in an infinite waiting for memory to free up.

Expected behavior

The API of zone_malloc (or PaRSEC for that matter) should distinguish between error and zero-sized allocations.

Proposal

Adapt an interface similar to cudaMalloc where the pointer is passed as parameter and a return value indicated success or failure.

devreal avatar Apr 01 '24 21:04 devreal

The API is based on malloc. I understand the easiness of allocating 0 bytes, but the code doing so should validate NULL as a correct answer if 0 bytes were requested.

bosilca avatar Apr 02 '24 16:04 bosilca

Please reopen if you hard-disagree with following malloc-like API.

abouteiller avatar Nov 27 '24 19:11 abouteiller