Skip to content

Commit fed9cb3

Browse files
committed
added resetStates() for memory optimization
Signed-off-by: Andy Miller <rhuk@mac.com>
1 parent 92cd68c commit fed9cb3

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

classes/plugin/ShortcodeManager.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,26 @@ public function resetObjects()
145145
$this->objects = [];
146146
}
147147

148+
/**
149+
* reset the states
150+
*/
151+
public function resetStates()
152+
{
153+
$this->states = [];
154+
}
155+
156+
/**
157+
* Reset all accumulated state (objects, assets, states).
158+
* Useful for batch processing scenarios like search indexing
159+
* where memory needs to be freed between pages.
160+
*/
161+
public function resetAll()
162+
{
163+
$this->objects = [];
164+
$this->assets = [];
165+
$this->states = [];
166+
}
167+
148168
/**
149169
* returns the current handler container object
150170
*

0 commit comments

Comments
 (0)