ddb icon indicating copy to clipboard operation
ddb copied to clipboard

Better memory management

Open pszturmaj opened this issue 8 years ago • 0 comments

See https://github.com/pszturmaj/ddb/blob/f45f0ba7961929254e6a63b346b20199e802f422/source/ddb/postgres.d#L1049

This was supposed to be temporary, until I'd finish other parts, but stayed here until now. It needs to be rewritten to reuse the buffer if possible. I would leave it as is for big messages, with configurable threshold in bytes and for messages smaller than threshold I would reuse a growable buffer. This change should prevent many unnecessary allocations and is fairly simple to do.

A little more complex but better solution would be receiving a fixed size buffer, then consuming that buffer field by field, and when you read past end of the buffer it should refresh the buffer with new content under the hood.

pszturmaj avatar Feb 22 '17 13:02 pszturmaj