-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?

Flimzy
  • 68,325
  • 15
  • 126
  • 165
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
  • 36,165
  • 6
  • 76
  • 80