[development] allowed memory size exhausted

Frederik Grunta fgrunta at gmail.com
Fri Jan 14 13:22:36 UTC 2011


Just because the stack trace doesn't show the error going through custom
modules doesn't mean that it's not a custom modules fault.

An out of memory exception will be thrown the moment that a piece of code
attempts to allocate an amount of memory which would put it over the memory
limit. It does not mean that a piece of code is necessarily faulty. This
means that module A could allocate 299 MB of memory, then when module B is
called, it needs 1 MB, and the stack trace would show the call going via
module B.

As Zereef has said, if worst comes to worst, a memory profiler should help
you diagnose the problem.

- Frederik

On 14 January 2011 13:14, Zareef Ahmed <zareef at zareef.net> wrote:

> I believe you got the message .. as some sentence were not in flow due to
> my fast typing  .. :)
>
> On Fri, Jan 14, 2011 at 6:39 PM, Zareef Ahmed <zareef at zareef.net> wrote:
>
>> To debug why your code is requesting this kind of memory you can try
>> following steps.
>>
>> 1. First increase the memory in your ini SO you can get rid of this memory
>> allocation error, you can try to increase this to around 1 GB or something
>> similar (depends how much memory you have on your machine)... If even
>> increasing memory upto that HUGE level does not help you, then something is
>> really really WRONG with your setup, which need to be looked upon within
>> code for some loops or something like that.
>>
>>
>> 2. If you are able to run your application by increasing Memory, please
>> install APD on your server. see http://in.php.net/apd
>> Use APD to track which functions are taking more memory to debug your
>> application.
>>
>>
>> Also check if problem is  new on this server and application runs fine or
>> other machine with different version of PHP, in some recent versions of PHP
>> few functions behavior has been changed due to which few scripts or older
>> module behave in unexpected way..
>>
>>
>> Thanks and Regards
>> Zareef Ahmed
>>
>>
>> On Fri, Jan 14, 2011 at 7:12 PM, Pierre Rineau <
>> pierre.rineau at makina-corpus.com> wrote:
>>
>>>
>>> > [Fri Jan 14 11:02:21 2011] [error] [client 1.2.3.4] PHP Fatal error:
>>> > Allowed memory size of 335544320 bytes exhausted (tried to allocate
>>> > 22175001 bytes) in /var/www/abc/includes/database.mysql-common.inc on
>>> > line 34
>>>
>>> Did you really allowed 320M of memory for PHP scripts execution or I
>>> miscalculated?!
>>>
>>> This is howfully huge!
>>>
>>> What are you trying to do here that could consume something like 10
>>> times the "normal" drupal memory consumption?
>>>
>>> Pierre.
>>>
>>>
>>>
>>
>>
>> --
>> Zareef Ahmed
>> http://www.zareef.net
>>
>
>
>
> --
> Zareef Ahmed
> http://www.zareef.net
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20110114/a0489c8a/attachment.html 


More information about the development mailing list