The generic object pool
Used for making the objects reusable
This is the efficient anti-measure for memory leaks
| C# | Visual Basic | Visual C++ |
public class ObjectPool<T> where T : new()
Public Class ObjectPool(Of T As New)
generic<typename T> where T : gcnew() public ref class ObjectPool
- T
| All Members | Constructors | Methods | Properties | ||
| Icon | Member | Description |
|---|---|---|
| ObjectPool<(Of <(<'T>)>)>()()()() |
Constructor for a pool with default size
| |
| ObjectPool<(Of <(<'T>)>)>(Int32) |
Constructor
| |
| Count |
Returns the current count
| |
| Equals(Object) | (Inherited from Object.) | |
| Finalize()()()() | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
| Get()()()() |
Releases an object from the pool
| |
| GetHashCode()()()() | Serves as a hash function for a particular type. (Inherited from Object.) | |
| GetType()()()() | Gets the type of the current instance. (Inherited from Object.) | |
| MemberwiseClone()()()() | Creates a shallow copy of the current Object. (Inherited from Object.) | |
| PoolSize |
The maximum number of objects that this pool can hold
| |
| Put(T) |
Adds an object to the pool
| |
| Put(List<(Of <<'(T>)>>)) |
Puts a list of objects into the pool
| |
| ToString()()()() | (Overrides Object.ToString()()()().) |
Coded by Danko Kozar
| Object | |
| ObjectPool<(Of <(<'T>)>)> | |