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
0
votes
0 answers

Is there any library which implements a fair resource pool queue in Java?

I need to create channels to other nodes (channels to RabbitMQ nodes which aren't thread safe). I can not create a new channel each time a user sends a message (It is too costly and also RabbitMQ has some limitations for it). So, I decided to create…
0
votes
2 answers

How to implement an Object Pool for Flex Data/Item Renderers

You can hook into the creation of Flex 4 item renderers easily enough (through itemRenderer, or itemRendererFunction) allowing you to pull renderers from a custom object pool, but how would you put those renderers back into the pool? I understand…
0
votes
1 answer

Null Reference When Calling OnTriggerEnter?

long story short, I am creating an object pooling system and in my script (see below), PickAxeTestManager, I am getting ERROR CS1501 "No overload for method OnTriggerEnter takes 0 arguments" on line 22. using UnityEngine; using…
0
votes
1 answer

How do I properly Object Pool enemy waves with an IEnumerator

Hopefully someone can help me with this issue. I'm trying to couple an IEnumerator with my object pooling script to instantiate enemies in waves. But I can't get them to instantiate without immediately destroying themselves 2 or 3 times and then…
0
votes
1 answer

How to Code Obstacle to Go Back Into My Object Pooler When They Collide With a Boundary?

Please do not feel intimidated by my long question, I am sure I just worded it weird lol. I followed Mike Geig's excellent tutorial on using Object Pooling in Unity, and I get the concept pretty well. I just have a question on something that has…
0
votes
1 answer

Error adding GameObject to list in class

I am having issues in adding a GameObject to a List<>. When I build this program an error occurs in poolInstances.Add(clone): Error: List.Add(RecyclingGameObject) has some invalid arguments. Error also occur on return clone; line: Error:…
Hit Man
  • 15
  • 6
0
votes
1 answer

Concurrent object pool whose products' lifetime is fully controlled by the smart pointer(s) containing the object

I wanna design a Concurrent object pool in C++, possible prototype as: template class Pool { public: template void new(std::shared_ptr & product); // more details... }; Once object(product) is…
Clinton
  • 57
  • 1
  • 4
0
votes
1 answer

Object Pooling in c# for dll referenced by asp.net, .Net 4.5.1

I am referencing a (black box) dll which has extremely expensive initialization (takes 3-4 seconds). It is used by an asp.net application that has several hundred simultaneous users. Because of the expensive initialization I cannot use it as an…
Tom Regan
  • 3,580
  • 4
  • 42
  • 71
0
votes
1 answer

Object pooling using Apache commom pool in java

This is my java code SparkConf sparkConf = new SparkConf().setAppName("Hive"); JavaSparkContext ctx = new JavaSparkContext(sparkConf); HiveContext sqlContext = new HiveContext(ctx.sc()); Row[] results = sqlContext.sql("Select *…
wazza
  • 770
  • 5
  • 17
  • 42
0
votes
1 answer

Singleton class vs Object pooling

For Stateless object Which one we should use, whether to create Singleton class for it or create Object pool for it. Where does the difference come between object pooling and singleton class? what are the condition when we can choose them over each…
0
votes
1 answer

Artifacts when recycling Android view objects

I am introducing view object recycling into my Android app to help performance. It does help with that. But when a new screen appears, I am seeing brief artifacts which I assume are related to the prior state of the views. The artifacts take the…
William Jockusch
  • 26,513
  • 49
  • 182
  • 323
0
votes
1 answer

reset Android FrameLayout object to "clean" state

I am trying to implement my own Android view recycling. My question is, is there a simple way to "reset" an Android View object (more specifically, a FrameLayout) to the state in which it would come out of a constructor. In other words, it knows…
0
votes
1 answer

Design pattern: Object pool of connections

Recently I started researching more information about the object pool design pattern and I ran into questions that I couldn't found them an answer. the idea of the object pool pattern is to save expensive resources by reusing them. for examle the…
0
votes
1 answer

Java resource pool

I have an app that stores data in XML. When user asks for data, XML is parsed into entities, which are then showed to him via something-like-servlet. My problem is, that after every refresh, something-like-servlet has to process data again and…
toothbrush
  • 43
  • 1
  • 5
0
votes
0 answers

ObjectPooling for Nested Objects - Best technique

I have a nested object with many nesting layers. Each object is basically containing list of some other types. I need to create a huge number of objects of these (almost 100 K) in short duration, and then discard them and then again create new. I…
Rajesh Gaur
  • 287
  • 5
  • 11