Forest Logo
search
package_2

objectpool

By @cometahn1042f

Roblox

Mirrored from Wally

ObjectPool

ObjectPool is an instance recycling library for Luau on Roblox. It minimizes runtime allocations and garbage collection pressure by reusing Instance objects by ClassName.

Documentation Index

  • API Reference: ObjectPool.new, GetInstance, ReturnInstance.
  • Architecture & Design: Instance recycling queue design.
  • Performance & Memory Profile: Allocation suppression metrics.
  • Failure Modes & Exception Guarantees: State cleanup requirements before returning instances.
  • Executable Examples: Practical usage patterns for projectile/particle pooling.

Quick Start

local ObjectPool = require(path.to.ObjectPool)

-- Create a pool storing up to 50 instances per ClassName
local pool = ObjectPool.new(50)

-- Fetch a Part instance
local part = pool:GetInstance("Part")

-- Return instance to pool when done
pool:ReturnInstance(part)

Package Details

Install command (Click to copy)


Version

0.1.2

License

MIT

check_circle

Safe for commercial use

Automated license review — not legal advice.