imagecreatefromjpeg failing with lack of memory

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Has anyone else experience of imagecreatefromjpeg failing with an error
message about memory even though the size of the image being uploaded is
nothing like the space available to the script?

Is imagecreatefromjpeg particularly memory hungry?

Immediately prior to the failure memory is given as 2405072
The jpeg being uploaded is 812201 in size
Smaller jpegs work fine.  jpegs created by different means all seem to fail
if the size is around 500k plus.

Error message is
Fatal error: Allowed memory size of 16777216 bytes exhausted at (null):0
(tried to allocate 3264 bytes) in
/home/virtual/site216/fst/var/www/html/mv/private/mvaddinfoinc.php on line

PHP version is 4.3.3 on a shared server
GD version is bundled (2.0.15 compatible)
Memory limit is set to 16M
Max upload is set to 16M

if (function_exists('memory_get_usage')) {
    $mem_in_use= memory_get_usage();
   else {
    $mem_in_use="memory usage indeterminable";
   dev_echo("memory usage= $mem_in_use" );
   $src_img = imagecreatefromjpeg("$temp_fullpicname");
   if (!$src_img) {
    $GLOBALS[InfoMsg]->MsgAdd("Could not create image from jpeg");
    unlink ( $temp_fullpicname);
    return false;

Site Timeline