#20913 [Bgs]: emalloc / erealloc FATAL errors
| From: | matt8192 at yahoo dot com | Date: | Tue, 10 Dec 2002 04:30:37 +0000 |
| Subject: | #20913 [Bgs]: emalloc / erealloc FATAL errors | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-27231@lists.php.net to get a copy of this message | ||
ID: 20913
User updated by: matt8192@yahoo.com
Reported By: matt8192@yahoo.com
Status: Bogus
Bug Type: Reproducible crash
Operating System: Solaris 8
PHP Version: 4.2.3
New Comment:
okay, thank you for the help!
I double-checked PHP documentation and it doesn't mention
anything about large files or memory mapping methods in
fpassthru. Perhaps it would be worth adding a blurb?
thanks again,
-Matt
Previous Comments:
------------------------------------------------------------------------
[2002-12-09 20:25:50] iliaa@php.net
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.
------------------------------------------------------------------------
[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