Need advise here. Currently I am get the memory usage of the script by using this code
$sysMem = escapeshellcmd(system('echo $(free)'));
memory_get_usage();
This is the result i am getting :
Total Mem : 1034708
Used Mem : 1014572
Free Mem : 20136
Shared Mem : 0
Buff Mem : 73456
Cached Mem : 480752
----------------------------------------------------
Mem Usegae : 509464
Total Mem : 1034708
Used Mem : 1014564
Free Mem : 20144
Shared Mem : 0
Buff Mem : 73456
Cached Mem : 480828
----------------------------------------------------
Mem Usegae : 343904
However i found out that the memory usage is kind of inconsistent and at time the memory usage might even exceed the total memory which is impossible.
Is memory_get_usage(); the best option to get the memory usage of the php script?
Or is it i need to use unset() function. However even if i use the memory still about the same
if there are other methods please kindly advise.
Thanks a millions
Guys and Ladies