1

I'm getting this error

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 4194304 bytes)

How come he tried to allocate 4194304 (which is smaller than the limit he specifies 134217728) and is exhausted?

Noam
  • 3,253
  • 3
  • 30
  • 50

2 Answers2

1

When working with resource heavy operations there are a couple of things to consider and multiple steps to prevent memory exhaustion.

  • How much data do we cache at any given time?
  • How many iterations will there be?
  • How do I keep the memory usage down to a minimum?
  • Do I have to keep all data in memory during the entire execution?
  • ...

You are exhausting your memory most likely due to not flushing or destroying old data from the current execution. That is why PHP peaks it's allowed allocation of system memory.

Daniel
  • 3,504
  • 4
  • 23
  • 43
0

PHP tried to allocate an extra of 4194304 bytes (after your code reached the upper limit of 134217728) , but your code exhausted that too.)

134217728 was the limit which your code exceeded.

Shankar Damodaran
  • 65,155
  • 42
  • 87
  • 120