Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom memory allocators in object slicer #544

Open
cthulhu-rider opened this issue Jan 15, 2024 · 2 comments
Open

Support custom memory allocators in object slicer #544

cthulhu-rider opened this issue Jan 15, 2024 · 2 comments
Labels
feature Completely new functionality I2 Regular impact S2 Regular significance U4 Nothing urgent

Comments

@cthulhu-rider
Copy link
Contributor

cthulhu-rider commented 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

// SetPayloadBuffer sets pre-allocated payloadBuffer to be used to object uploading.
// For better performance payloadBuffer length should be MaxObjectSize from NeoFS.
func (x *Options) SetPayloadBuffer(payloadBuffer []byte) {
that requires buffer to be of size MaxObjectSize (64MB).

@roman-khimov
Copy link
Member

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 roman-khimov added U4 Nothing urgent S2 Regular significance I2 Regular impact labels Jan 16, 2024
@cthulhu-rider
Copy link
Contributor Author

cthulhu-rider commented Jan 18, 2024

Pools/buffers should be sufficient for this

these are custom allocators to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Completely new functionality I2 Regular impact S2 Regular significance U4 Nothing urgent
Projects
None yet
Development

No branches or pull requests

2 participants