in reply to Re^3: endless loop problems
in thread endless loop problems

This might be getting a little on the OT side but how much memory is used up at a time in this situation? Does the memory clear after each image? Does it pile itself up?

I'm not so much into the technical side of things, but I'd have to think that storing an image locally might take a little longer but it would clear up a lot of unecessary memory and it'd be faster to process the image sizes if they were locally stored. So when it comes to the memory usage, if storing the files, wouldn't it only be a problem for a short while instead of the duration of the entire loop above?

I could be speaking nonsense as I have no real clue how this stuff really works.

Replies are listed 'Best First'.
Re^5: endless loop problems
by ikegami (Patriarch) on Jun 28, 2006 at 16:46 UTC

    This might be getting a little on the OT side but how much memory is used up at a time in this situation?

    length($gal) + length($image) + size of list of urls + overhead

    It could be changed to
    max( length($gal), length($image) ) + size of list of urls + overhead
    but it's probably not worth it.

    Does the memory clear after each image?

    Yes. Variables $gal and $img get freed (to Perl, not to the OS) at the end of their respective enclosing blocks, since they are lexically scoped (my) variables. I could modify the code (by adding a set of curlies) to free $gal sooner, but it's not worth it.

    Only one gallery is memory at a time.
    Only one image is memory at a time.

    I'd have to think [...] it'd be faster to process the image sizes if they were locally stored.

    No. You'd have to extra steps of storing them locally and reading them back in to memory (if only a bit at a time). That's a lot of disk IO you didn't used to have.