#20913 [Opn->Bgs]: emalloc / erealloc FATAL errors
| From: | iliaa@php.net | Date: | Tue, 10 Dec 2002 02:25:51 +0000 |
| Subject: | #20913 [Opn->Bgs]: emalloc / erealloc FATAL errors | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-27224@lists.php.net to get a copy of this message | ||
ID: 20913
Updated by: iliaa@php.net
Reported By: matt8192@yahoo.com
-Status: Open
+Status: Bogus
Bug Type: Reproducible crash
Operating System: Solaris 8
PHP Version: 4.2.3
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Well, what if 5 users retrieve the file all your ram will be used up
and the 6ht users will get the error you see here. For performance
reasons fpassthru() uses mmap, which maps the entire file to memory. If
you need to send large files >10megs to the user, use fread() and read
the file in smaller chunks, 1-2 megs, that should prevent memory issues
and maintain reasonable level of performance.
Previous Comments:
------------------------------------------------------------------------
[2002-12-09 18:45:20] matt8192@yahoo.com
When I use fpassthru to send large media files (100-500
MB) to the user, it sometimes causes that Apache thread to
crash, and it's taken down the entire Solaris box (!) two
or three times.
Apache's error log entries look like this:
FATAL: emalloc(): Unable to allocate 205164673 bytes
FATAL: erealloc(): Unable to allocate 205166593 bytes
FATAL: erealloc(): Unable to allocate 205166593 bytes
The box has a gig of RAM. Does fpassthru not work with
large files? Is there a better method?
Thanks
-Matt
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=20913&edit=1