| View previous topic :: View next topic |
| Author |
Message |
Humpa Site Admin

Joined: 06 Nov 2005 Posts: 10258
|
Posted: Thu Aug 16, 2007 9:40 pm Post subject: BUG FIX: memory leak fixed, sending large pics/videos works |
|
|
Thanks to vivacia over at www.HowardForums.com, we can now send large files without the script failing because it runs out of memory.
As some of you know, we were adding a line to the send.php to increase the memory_limit in the php.ini on the server.
| Code: |
| ini_set('memory_limit','32M'); // temporarly increases allowed memory usage to 16M |
But not everyone has access to that "fix" though, and it was only a work-around for a problem that should not have existed anyway.
Well, vivacia saw where the problem was, and offered a solution.
Like we always knew, the problem was in the mmsdecoder.php file. The new mmsdecoder.php file is now in the humpa_mms download zip, but I've also made it available here:
www.humpa.com/downloads/mmsdecoder.zip
Just replace/overwrite your existing mmsdecoder.php file with the one in the zip and you are good to go!
For those interested, here's what was wrong.
| vivacia wrote: |
After looking into it, I found out that mmsdecoder.php uses too much memory in its constructor; it's allocating a big array to store every character in the file as an ASCII character and as a result, too much memory is being allocated.
To fix this, I've changed the code to use convert the characters in the files to ASCII on the fly (or when needed) which has cut down the memory usage a lot. I can now send 400kb pictures with no apparent difficulties. |
|
|
| Back to top |
|
 |
dacool25
Joined: 29 Apr 2007 Posts: 60
|
Posted: Fri Aug 17, 2007 7:24 am Post subject: |
|
|
So all that we need to do is replace the mmsdecoder.php right?
No need for "ini_set('memory_limit','32M'); // temporarly increases allowed memory usage to 16M" |
|
| Back to top |
|
 |
Humpa Site Admin

Joined: 06 Nov 2005 Posts: 10258
|
Posted: Fri Aug 17, 2007 9:03 am Post subject: |
|
|
| dacool25 wrote: |
So all that we need to do is replace the mmsdecoder.php right?
No need for "ini_set('memory_limit','32M'); // temporarly increases allowed memory usage to 16M" |
That's correct.
But every server is different and will have different results with memory usage. I also don't know what everyone's default memory_limit is set to.
Most servers will be set to 8M or 16M I think. I left that ini_set in my file, and I set it to 32M just for good measure - though I see in my phpinfo that my memory_limit is 40M ... lol ... so I guess I should remove that line!  |
|
| Back to top |
|
 |
Humpa Site Admin

Joined: 06 Nov 2005 Posts: 10258
|
Posted: Fri Aug 17, 2007 9:12 am Post subject: |
|
|
Actually, I think you can just ignore the ini_set memory_limit ... that does not seem to matter.
I just set mine to a memory_limit of 8M (and I verified that my server does allow that and was actually registering the memory_limit as 8M), and I sent a pic that was 470KB (that's about the limit that I can send from my phone - I'm restricted to 500KB by my Verizon VX9900). My pic went thru just fine.  |
|
| Back to top |
|
 |
|