Last active
November 7, 2019 02:00
-
-
Save arispublic/8cbd96eee38fdc316e4eb3693ba4c740 to your computer and use it in GitHub Desktop.
Fix Out of memory issue in preg_replace syntax
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * If you have a PHP Fatal error: Out of memory (allocated 147161088) (tried to allocate 42524112 bytes) in /wp-includes/wp-db.php on line 3042 | |
| * It's probably due to the preg_replace is still keep the memory used in previous process. | |
| * I added the code below to wp-db.php file and the problem is gone. But you have to hack the wordpress core code, which is not a good practice. | |
| */ | |
| for ($i = 0; $i < 4096; $i++) { | |
| preg_replace('/\d/', '', 1); | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment