memory management - PHP memory_get_usage is larger than memory_limit -


my php application has been running bit slow , it's not memory efficient @ moment. whole server has been going down , think have app blame. thought i'd monitor memory usage , check how have limit:

echo 'memory in use: ' . memory_get_usage() . ' ('. memory_get_usage()/1024 .'m) <br>'; echo 'peak usage: ' . memory_get_peak_usage() . ' ('. memory_get_peak_usage()/1024 .'m) <br>'; echo 'memory limit: ' . ini_get('memory_limit') . '<br>'; 

this shows following:

memory in use: 629632 (614.921875m)  peak usage: 635696 (620.796875m)  memory limit: 128m 

how be? memory in use way larger memory limit? either something's broken or not understand @ how memory_limit setting works (or memory_get_usage() )

thank all.

memory_get_usage returns in bytes, calculating there in kb. divide 1024 again have in mb

same goes memory_get_peak_usage

e.g.

echo 'memory in use: ' . memory_get_usage() . ' ('. ((memory_get_usage() / 1024) / 1024) .'m) <br>'; 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -