Create a new Perflab_Background_Process::memory_exceeded method to calculate and return the memory used within the background process. This functions checks the total memory used is 90% of the servers memory limit. The boolean returned is also filterable so other developers can set the memory limit.
Acceptance Criteria
- Create a new
memory_exceeded method the Perflab_Background_Process class
- The method accepts no parameters
- The method returns a boolean
- The total memory limit is calculated by taking
ini_get( 'memory_limit' ) or a fallback value of 128M. This value is then converted to bytes using the wp_convert_hr_to_bytes function and multiplied by 0.9 to calculate 90% of the total memory limit.
- The calculated memory limit is tested by checking if it is
>= to the value returned by memory_get_usage()
- The boolean value returned is filtered using apply_filters(
perflab_background_process_memory_exceeded, $return );`
Create a new
Perflab_Background_Process::memory_exceededmethod to calculate and return the memory used within the background process. This functions checks the total memory used is 90% of the servers memory limit. The boolean returned is also filterable so other developers can set the memory limit.Acceptance Criteria
memory_exceededmethod thePerflab_Background_Processclassini_get( 'memory_limit' )or a fallback value of128M. This value is then converted to bytes using thewp_convert_hr_to_bytesfunction and multiplied by0.9to calculate 90% of the total memory limit.>=to the value returned bymemory_get_usage()perflab_background_process_memory_exceeded, $return );`