Questions tagged [object-pooling]

The object pool pattern is a software creational design pattern that uses a set of initialized objects kept ready to use – a "pool" – rather than allocating and destroying them on demand.

The object pool pattern is a software creational design pattern that uses a set of initialized objects kept ready to use – a "pool" – rather than allocating and destroying them on demand. A client of the pool will request an object from the pool and perform operations on the returned object. When the client has finished, it returns the object to the pool rather than destroying it; this can be done manually or automatically.

Object pools are primarily used for performance: in some circumstances, object pools significantly improve performance. Object pools complicate object lifetime, as objects obtained from and return to a pool are not actually created or destroyed at this time, and thus require care in implementation.

Object pooling can offer a significant performance boost in situations where the cost of initializing a class instance is high and the rate of instantiation and destruction of a class is high – in this case objects can frequently be reused, and each reuse saves a significant amount of time. Object pooling requires resources – memory and possibly other resources, such as network sockets, and thus it is preferable that the number of instances in use at any one time is low, but this is not required.

http://en.wikipedia.org/wiki/Object_pool_pattern

171 questions
1
vote
2 answers

Connection pool for couchdb

I have one couchdb database and I am querying it in parallel. Now, I want to create a connection pool, because I discovered a bottleneck in my design - I was using a single instance of couchd , so parallelization was failing due to that. I searched…
anvarik
  • 6,417
  • 5
  • 39
  • 53
0
votes
2 answers

pop-push element from std::vector and reuse elements

i have a project in c++03 that have a problem with data structure: i use vector instead of list even if i have to continuously pop_front-push_back. but for now it is ok because i need to rewrite too many code for now. my approach is tuo have a…
nkint
  • 11,513
  • 31
  • 103
  • 174
0
votes
1 answer

Can we use Object Pooling concept instead of declaring large size byte array?

I have a question that Can we use Object pooling concept instead of declaring large size byte array as 20MB. If yes then How? Actually I have a statement as byte[] fileData = new byte[2097152]; because I have to read that much data from a video file…
Sanat Pandey
  • 4,081
  • 17
  • 75
  • 132
0
votes
2 answers

is there a proprietary java object pooling library?

I need to create a pool of socket connections (TCP). I'm planning to use commons pool but would like to know about any proprietary object pool libraries in the market. Thank you Bhargava
BoCode
  • 847
  • 4
  • 17
  • 33
0
votes
1 answer

Object Pool not working

I'm having trouble setting up my object pool. I created a "BallPoll" custom class to handle the pooling logic. I first call fillPool() to add 20 Ball objects into my array. Then in my document class when I want to create a Ball, I check the pool…
user1114288
  • 13
  • 1
  • 3
0
votes
1 answer

COM Object Pooling and .NET Web Service

I have a COM object which I need to access from my .NET Web Service. I know of the whole STA/MTA thing - so my COM object would be converted to be MTA and have no global state (while not being multi-threaded itself). If I set this up as a COM+…
Duncan
  • 10,218
  • 14
  • 64
  • 96
0
votes
1 answer

AS3 Object Pool for sound effects

I am building a game where I need top handle A LOT of sound effects. I created an object pool for the effects to be able to reuse them. My problem is how I should write a nice pool solution without having to create a pool for each sound type. The…
Mattias
  • 3,907
  • 4
  • 28
  • 50
0
votes
0 answers

How can I stop my Object Pool Object (ProjectilePool Object) from Auto Spawning?

enter image description here My Object Pool aka ProjectilePool prefab keeps playing when I hit play mode in Unity. It keeps shooting its projectiles without me hitting the "Fire1" mouse button.Is there some way to get it to not appear in the scene…
0
votes
0 answers

ObjectPool -> DontDestroyOnLoad or not?

I have a question while studying for UNITY Which is better? Setting the ObjectPool to "DontDestroyOnload". and whenever scene is switched, return all active objects to the object pool. or Not setting the ObjectPool to "DontDestroyOnload". Instead,…
w ing
  • 31
  • 3
0
votes
1 answer

How to create an ObjectPool in .NET 6 for a custom parameterless class?

This is a continuation of a previous SO question I asked. I'm trying to create an ObjectPool of my FTP Clients. FTP Clients are expensive to use because of the "connection" step. So I thought -> let's pool them so after the initial connection step,…
Pure.Krome
  • 84,693
  • 113
  • 396
  • 647
0
votes
1 answer

Does .NET 6 have an ObjectPool class so I can pool my SFtpClient's?

I'm trying to find any code examples/docs about ObjectPooling in .NET 6. I can see this exists in .NET 7 via these docs, but I'm unable to upgrade to .NET 7. I did find -some- code somewhere (No I can't see where. It was on my work computer, not…
Pure.Krome
  • 84,693
  • 113
  • 396
  • 647
0
votes
1 answer

Score counter not increasing after recalling object from a pool with raycast detection hit

Context Hello, its me again. I have been playing around with "Object Pool" and it is fascinating the amount of CPU performance can save up. However, I have encountered a new "feature" where it scores once for the object being called and going…
0
votes
1 answer

disabling gameObjects after seconds using object pooling and coroutines

I'm developing a simple VR shooter in unity, i use object pooling for the bullets (Lasers here) this is the ObjectPool script, here i istantiate a list of bullets in the start() method and disable them. public class ObjectPool : MonoBehaviour …
0
votes
1 answer

Unity Object Pooling is Not Working When Scene Change or Refresh

I wrote an ObjectPooler code by watching this Brackeys tutorial. It's working fine until I duplicate it to another scene. In the second scene when the scene changes or refreshes object pooler is not working anymore. It's spawning objects but doesn't…
0
votes
1 answer

How to set Object pooling correctly in 2D game?

I have a couple of problems with object pooling in Unity with my 2D game, cannon balls don't want to stop when there is a collision with the wall, and 1 of them bursts shoot and the other 9 shoot together connected with each other, my cannon is…