Reply to Re: PHP and memory use

Your name:

Reply:


Posted by Michael Fesser on 07/21/07 01:11

..oO(NC)

>On Jul 20, 4:21 pm, Alfred Molon <a...@b.c> wrote:
>
>> How to reduce the amount of memory needed?
>
>By design, of course. I would hazard a guess that your problem has
>something to do with page content being formed inside a loop and then
>dumped in one fell swoop. Something like this:

I don't think so.

>$content = '';
>// ...
>while ($record = mysql_fetch_array($result)) {
> $content .= "<img src='{$record['imageURL']}'>";
>}
>// ...
>echo $content;

I use this extensively in my own framework, simply because there's no
other way for me to perform particular tasks (filtering and output
caching for example). But even when creating long and complex pages with
a lot of nested objects, each storing its own output buffer, this has
never become a memory issue for me. My most complex page until now (with
55 database queries, 111 loaded classes, 324 objects created while
script execution, 344KB final HTML code) just consumes 8.1MB.

>Another possibility is that your memory issues come from resizing
>large images.

I'm pretty sure that this is the reason, but without knowing some code
it's impossible to say. It might help to call memory_get_usage() from
time to time to see where the real hole is.

>If that's the case, there's really nothing you can do,
>other than limit the size of images you can upload...

"Please don't upload 10 megapixel images." ;)

Micha

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация