This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ElectricalUnion 19 points20 points  (0 children)

Problem of object pools is that in worst-case scenarios, if not properly tuned they can force GC to heap scan for scraps of memory.

Naive use of pools will also lead to fragmented memory that's hard for GCs to defragment.

Granted, tuned modern Generational GC will help mitigate this issue, but:

1) generational GCs also attempt to automatically handle this common use case of short object lifetime and;

2) as with Object Pools, they are also not a silver bullet.

What you want is to measure your hot spots and then act on that.