danielealbano / cachegrand

cachegrand - a modern data ingestion, processing and serving platform built for today's hardware
BSD 3-Clause "New" or "Revised" License
975 stars 34 forks source link

FFMA realloc check object size #353

Closed danielealbano closed 1 year ago

danielealbano commented 1 year ago

The ffma_mem_realloc mimics the behaviour of realloc and therefore should have the same signature, the pointer to resize and the new size.

The function should also check if the new size still fit in the size class of the allocation, if yes it can just return the existing pointer avoiding further allocations! This specific case is extremely common in cachegrand.

This PR introduces these 2 fixes and update the code to take into account these changes as some functionalities were relying on ffma_mem_realloc zero-ing the memory and therefore now need to do it by themselves.