|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-10-30 16:42 UTC] ak at pre-secure dot de
Description:
------------
When trying to create an image from a file and an error occures PHP will lose some memory.
Reproduce code:
---------------
while(true) {
print "\nMemory: ".memory_get_usage();
imagecreatefrompng("anyimage.png");
}
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 01 19:00:01 2025 UTC |
I was able to reproduce the Problem with the current release. It occurs if you try to open an image with an crc error. Reproduce code: --------------- while(true) { print "\nMemory: ".memory_get_usage(); imagecreatefrompng("anyimage.png"); } Image: -------------- http://drahop.de/php/anyimage.pngI already said that it was working here. pierre@ubuntu:~/cvs/php53/bld$ ./sapi/cli/php -r "imagecreatefrompng('http://drahop.de/php/anyimage.png');" Warning: imagecreatefrompng(): gd-png: fatal libpng error: IDAT: CRC error in Command line code on line 1 Warning: imagecreatefrompng(): gd-png error: setjmp returns error condition in Command line code on line 1 Warning: imagecreatefrompng(): 'http://drahop.de/php/anyimage.png' is not a valid PNG file in Command line code on line 1 There is no error either through valgrind. And yes, the memory usage of PHP MM increases as you keep creating errors, but the memory is freed when it exits >> no leak. If you read the valgrind output you pasted here, you will see that it did not find any error either...