My app uses large amounts of memory; it actively allocates and frees lots
of slices.
I'm talking about gigabytes here.
With the default GOGC=100 setting, it needs twice more memory.
When I decrease GOGC to a lower value, it affects performance pretty badly.
So far the best solution I have found
On Tue, May 2, 2017 at 8:35 PM Piotr Narewski wrote:
> Does anyone know a way to do something like this (freeing memory on
demand), but using pure Go?
> Something that will compile (and work) on any platform, without any extra
dependencies..
sync.Pool could be probably a good fit. Usage example:
Thanks.
Sorry, but I don't quite get this usage example.
Wouldn't it require me to only use slices of a fixed size?
On Tuesday, May 2, 2017 at 9:30:45 PM UTC+2, Jan Mercl wrote:
>
> On Tue, May 2, 2017 at 8:35 PM Piotr Narewski > wrote:
>
> > Does anyone know a way to do something like this (
On Wed, May 3, 2017 at 3:14 PM Piotr Narewski wrote:
> Wouldn't it require me to only use slices of a fixed size?
No, the slice.Pool object has 63 sync.Pool objects:
https://github.com/cznic/internal/blob/e5e1c3e9165d0a72507c2bbb0ffac1c02b8d3f7c/slice/pool.go#L95,
ie. 63 buckets, one for each lo