0

I'm trying to figure out how to decrease the memory usage in a php script. Problem is that I need to use ini_set('memory_limit','1024M'); because I load 2 big arrays (2Million entries each) and I was wondering if I could swap memory in any way.

Process time is quite good but it takes like 610706920 when I use memory_get_usage.

Also I've been trying to reduce the memory usage by unsetting unused variables and arrays but it still spikes too high.

Nacho
  • 1
  • Can't you just partialy load the datas instead of the whole ? Working with chunks could be more memory efficient. This can be an [XY problem](https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem) – Cid May 09 '20 at 11:28
  • Instead of load the complete array in on a shot, break down the lengthy array to 'n' segments, And load the array segments one by one and make the intermediate result. so keep on processing intermediate results will new data segments will result in the final output. Try this methode. data manage ment is important while writing code. – jithu thomas May 09 '20 at 11:29

0 Answers0