178 questions
1 vote
2 answers
486 views
How to Implement a Garbage-Free Object Pool in Java?
My Java application has excessive garbage collection due to frequent object creation and disposal, so I want to implement an object pool to reuse objects and reduce GC overhead. How can I design a ...
0 votes
1 answer
58 views
Unity Object Pooling: IndexOutOfRangeException when releasing multiple objects simultaneously
I'm encountering an IndexOutOfRangeException in my Unity project when multiple objects are released from the object pool at the same time. For context, I'm working on a Unity project where tanks fire ...
1 vote
1 answer
713 views
How to return array to ArrayPool when it was rented by inner function?
I have a scenario when I need to operate on large array inside some inner function (a service) but result of this operation is to be consumed (serialized to JSON and returned over HTTP) by parent ...
0 votes
1 answer
94 views
Replace an existing object with a new one in the same place in memory
In C# it is possible to pool existing objects in an ObjectPool. But this only works for reference types that provide a method to reset the object to some well defined initial state. For example a type ...
0 votes
1 answer
63 views
Putting the Object Pool inside of the Object's class
I'm building an object pool and am find it really tedious to regularly reference a factory or and object pools to handle objects. Instead I'm considering building the pool directly into the object's ...
-1 votes
1 answer
388 views
StringBuilderPool Performance Benchmark Issue
In order to gain performance on the StringBuilder operations, I tried to apply the object pooling. But pooling the StringBuilder seems to be slower than the original usage on both net8 and net7. What ...
0 votes
1 answer
484 views
I have issue with Object Pooling in Unity
My Get() function in Object-Pooling keeping on instantiate more objects. I can't find the problem, there's no error. this is the Spawner Class. public class OPool : MonoBehaviour { public Bullet ...
0 votes
1 answer
116 views
How to ensure every object property is set in a TypeScript function?
I am developing a 2D canvas game using TypeScript and using the Object pool pattern. That is, when creating a new enemy, rather than always creating one like this: interface IEnemy { x: number, y: ...
0 votes
0 answers
54 views
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 ...
1 vote
3 answers
158 views
How to use a List in a Function(Advanced)
I am using static lists of classes, and am trying to simplify or genericize the functions for ease of typing and copy/pasting. I'll try to explain the best I can: public static List<Resources> ...
3 votes
1 answer
3k views
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 ...
1 vote
1 answer
911 views
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'...
3 votes
3 answers
2k views
caching python class instances
I have a memory heavy class, say a type representing a high-resolution resource (ie: media, models, data, etc), that can be instantiated multiple times with identical parameters, such as same filename ...
0 votes
1 answer
58 views
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&...
1 vote
0 answers
776 views
How do I create a RecyclerView for Unity?
I'm trying to recreate android's RecyclerView on Unity using ScrollRect and Unity's object pooling system. I was able to make it work great when scrolling using the mouse, but when I drag up and down (...