I was playing around and tried to allocate an extremely large image with imagecreatetruecolor(10000, 10000) to deliberately hit the memory limit on my server (8MB).
When I ran the script, it started consuming memory, then the script stalled, returned nothing, and the memory was freed. No "memory limit hit" message from PHP though, and memory usage of the script reached over 1GB (the script alone, not total memory usage on my system).
Does this mean that imagecreatetruecolor() doesn't obey the memory limit, or did I just miss something?
memory_limit doesn't affect imagecreatetruecolor?
Moderator: General Moderators
hmm.... it seems so. what does return memory_get_peak_usage()? (you may need recent version of php to use this function).
Will try, but I have WindowsXP at home, and I know some memory-related functions are not supported on Windows.Weirdan wrote:hmm.... it seems so. what does return memory_get_peak_usage()? (you may need recent version of php to use this function).
True, and a 100x100 image is probably about 40KB. But a 10000x10000 image is 400MB (in theory) and over 1GB in practice.feyd wrote:1K x 1K true color image is 4MB.
Happens, with all those 0's ...feyd wrote:oops, I thought I saw 1000, not 10,000 in your post.
That function doesn't exist on PHP 5.1.6, which is the latest stable windows version. I'll try my gentoo server tomorrow.Weirdan wrote:hmm.... it seems so. what does return memory_get_peak_usage()? (you may need recent version of php to use this function).
Thanks