Precisely that, the real concept behind ZO_ObjectPool is that you have a number of generic objects that you don't want to instantiate any time they're needed. So, ZO_ObjectPool will create an object, and when you release that object it goes back into a pool - never garbage collected. The next time you need an object, it asks that pool if any are sitting around unused and gives you that unused object instead of instantiating a new one.
It's a lot of fancy code to basically represent:
Lua Code:
local in_use = {}
local unused = {}
function GetNew()
if ( #unused ) then
return unused[ 1 ]
else
-- create new object
end
end
function Release( object )
--remove from in_use
table.insert( unused, object )
end
local obj = GetNew()
table.insert( in_use, obj )
obj:DoStuff()
Release( obj )