Support custom memory allocators in object slicer #211

Open
opened 2025-12-28 18:07:27 +00:00 by sami · 2 comments
Owner

Originally created by @cthulhu-rider on GitHub (Jan 15, 2024).

object slicer allocates byte buffers of certain size using Go built-in make function. From one side, it's normal default behavior for the library functionality. At the same time, some applications may desire to manage memory allocations deeper in order to improve app's performance

it's proposed to define app-level memory allocator (interface) and support it by the slicer as option. If set, this allocator is be used for processing, otherwise, slicer defaults to make

additionally, this approach will allow to get rid of nspcc-dev/neofs-sdk-go@1db2fbf3c1/object/slicer/options.go (L58-L60) that requires buffer to be of size MaxObjectSize (64MB).

Originally created by @cthulhu-rider on GitHub (Jan 15, 2024). object slicer allocates byte buffers of certain size using Go built-in `make` function. From one side, it's normal default behavior for the library functionality. At the same time, some applications may desire to manage memory allocations deeper in order to improve app's performance it's proposed to define app-level memory allocator (interface) and support it by the slicer as option. If set, this allocator is be used for processing, otherwise, slicer defaults to `make` additionally, this approach will allow to get rid of https://github.com/nspcc-dev/neofs-sdk-go/blob/1db2fbf3c1ad047d1ab3dd74d7c3a930856cf0f0/object/slicer/options.go#L58-L60 that requires buffer to be of size `MaxObjectSize` (64MB).
Author
Owner

@roman-khimov commented on GitHub (Jan 16, 2024):

Usually if you need a custom allocator you're doing something wrong, it'll be complicated and buggy. Pools/buffers should be sufficient for this.

@roman-khimov commented on GitHub (Jan 16, 2024): Usually if you need a custom allocator you're doing something wrong, it'll be complicated and buggy. Pools/buffers should be sufficient for this.
Author
Owner

@cthulhu-rider commented on GitHub (Jan 18, 2024):

Pools/buffers should be sufficient for this

these are custom allocators to me

@cthulhu-rider commented on GitHub (Jan 18, 2024): > Pools/buffers should be sufficient for this these are custom allocators to me
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
nspcc-dev/neofs-sdk-go#211
No description provided.