Skip to content

Commit

Permalink
Update expandFns.php
Browse files Browse the repository at this point in the history
  • Loading branch information
GlazerMann authored Jan 27, 2024
1 parent 9acdec0 commit 13b4fef
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions expandFns.php
Original file line number Diff line number Diff line change
Expand Up @@ -962,11 +962,16 @@ function throttle () : void {
if (preg_match('~^(\d+)M$~', $mem_max, $matches)) {
$mem_used = memory_get_usage() / (1024*1024);
$mem_max = 0.9 * @intval($matches[1]);
if ($mem_max !== 0 && ($mem_used > $mem_max)) {
@clearstatcache();
@strtok('','');
if ($mem_max !== 0 && ($mem_used > $mem_max)) { // Clear every buffer we have
/** @psalm-suppress UnusedFunctionCall */
@strtok('',''); // This should do nothing
HandleCache::free_memory();
$mem_used1 = (string) (memory_get_usage() / (1024*1024));
AdsAbsControl::free_memory();
unset($matches);
$mem_used2 = (string) (memory_get_usage() / (1024*1024));
$mem_used = (string) $mem_used;
bot_debug_log("Cleared memory: " . $mem_used2 . ' : ' . $mem_used1 . ' : ' . $mem_used);
}
}
$phase = $phase + 1;
Expand Down

0 comments on commit 13b4fef

Please sign in to comment.