2

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?

2
  • What does your code that produced this error look like? Commented Sep 22, 2013 at 10:32
  • 3
    4194304 is additional bytes that php was trying to allocate, but memory was full at that point. Commented Sep 22, 2013 at 10:32

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.