How do you debug php “Out of Memory” issues?

前端 未结 6 807
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-09 02:46

I\'ve had some issues lately with PHP memory limits lately:

Out of memory (allocated 22544384) (tried to allocate 232 bytes)

<
6条回答
  •  失恋的感觉
    2020-12-09 03:05

    Memprof is a php extension that helps finding those memory-eaters snippets, specially in object-oriented codes.

    This adapted tutorial is quite useful.

    Note: I unsuccessfully tried to compile this extension for windows. If you try so, be sure your php is not thread safe. To avoid some headaches I suggest you to use it under *nix environments.

    Another interesting link was a slideshare describing how php handles memory. It gives you some clues about your script's memory usage.

提交回复
热议问题