-1

Is there a way retrieving the size of a sync.Pool instance?

There’s an interesting solution about how to implement a pool yourself, giving you full control. But for most cases, I would like to just use sync.Pool and be done with it. Having the metrics would be nice though.

Any ideas?

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
Oliver
  • 89
  • 1
  • 8
  • 1
    You'll need to implement your own freelist, sync.Pool can remove objects at any time. – Marc Aug 11 '20 at 11:44

1 Answers1

2

Is there a way retrieving the size of a sync.Pool instance?

No.

Volker
  • 40,468
  • 7
  • 81
  • 87