http://php.net/manual/en/function.imagecreatefromjpeg.php#76968

I'll make this more understandable. I believe GD allocates 4 bytes per pixel and then there is a fudge factor.

http://www.dotsamazing.com/en/labs/phpmemorylimit