What is Object Pooling in Java?

2019-01-13 08:25发布

What is object pooling and what is a weak object reference ?

How can we implement them using Java?

7条回答
Animai°情兽
2楼-- · 2019-01-13 09:08

I implemented a simple ObjectPool in Java, see here It doesn't use weak object reference though. Purpose of weak object reference to allow collect an object memory even if there are references to the object, but they are weak. It is more useful for caches than for object pools, although can be used for them too.

查看更多
登录 后发表回答