Memory Overflow on Slideshow Memory Overflow on Slideshow
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Memory Overflow on Slideshow

Started by hermannakruse, February 01, 2007, 07:18:13 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

hermannakruse

Hallo
I have a Gallary with over 2000 Pictures and a quick server.
When I'm on an Slideshow every Preloaded Picture makes the Memory Cusumption Bigger.

Ther Problem ist that every Pictuer is stored in an Array but never relased.

The Function

function preLoadPic(index)
{
        if (Pic[index] != ''){
                window.status='Loading : '+Pic[index]
                preLoad[index] = new Image()
                preLoad[index].src = Pic[index]
                Pic[index] = ''
                window.status=''
        }
}

I would gess prealoding the Picture once and then realising it will do the work nearly as good becouse of the cache the browser has anyway.

Nibbler

Discussed here: http://forum.coppermine-gallery.net/index.php?topic=31945.0

To apply a limit as mentioned, change include/slideshow.inc.php

$pic_data = get_pic_data($_GET['album'], $pic_count, $album_name, -1, -1, false);

to for example

$pic_data = get_pic_data($_GET['album'], $pic_count, $album_name, 1000, -1, false);

Not tested though.

hermannakruse

The discusson on
http://forum.coppermine-gallery.net/index.php?topic=31945.0
is about server problem but my Problem ist the Client side

Each Picture more on Server side means some more Bytes to send to the client.

But for the Client each Picture meand one more Picture to hoals in Memory.

My Windows 2000 System with 1GB Memory told me it was out of Memory after seeing a few 100 Pictures from the PictureShow.
I Would geas changing the JavaScript

from

function preLoadPic(index)
{
        if (Pic[index] != ''){
                window.status='Loading : '+Pic[index]
                preLoad[index] = new Image()
                preLoad[index].src = Pic[index]
                Pic[index] = ''
                window.status=''
        }
}

function runSlideShow(){
   if (xIE4Up){
            document.images.SlideShow.style.filter="blendTrans(duration=2)"
                document.images.SlideShow.style.filter= "blendTrans(duration=crossFadeDuration)"
      document.images.SlideShow.filters.blendTrans.Apply()
        }
        document.images.SlideShow.src = preLoad[j].src
        if (xIE4Up){
           document.images.SlideShow.filters.blendTrans.Play()
        }

        pos = j

        j = j + 1
        if (j > (p-1)) j=0
        t = setTimeout('runSlideShow()', slideShowSpeed)
        preLoadPic(j)
}


to

function preLoadPic(index)
{
                window.status='Loading : '+Pic[index]
                preLoad[index] = new Image()
                preLoad[index].src = Pic[index]
                window.status=''
}

function runSlideShow(){
   if (xIE4Up){
            document.images.SlideShow.style.filter="blendTrans(duration=2)"
                document.images.SlideShow.style.filter= "blendTrans(duration=crossFadeDuration)"
      document.images.SlideShow.filters.blendTrans.Apply()
        }
        document.images.SlideShow.src = preLoad[j].src


preLoad[j]=nothing

        if (xIE4Up){
           document.images.SlideShow.filters.blendTrans.Play()
        }

        pos = j

        j = j + 1
        if (j > (p-1)) j=0
        t = setTimeout('runSlideShow()', slideShowSpeed)
        preLoadPic(j)
}


wold help more for my Problem.

Thanks

hermannakruse

One littel Update

I have testet it. Event if i had to change form
preLoad[j]=nothig

to
preLoad[j]=null

Have a look hear http://hak.mls20.de/mp/test.html

hermannakruse

Quote from: hermannakruse on February 02, 2007, 12:29:28 AM
The discusson on
http://forum.coppermine-gallery.net/index.php?topic=31945.0
is about server problem but my Problem ist the Client side

Each Picture more on Server side means some more Bytes to send to the client.

But for the Client each Picture meand one more Picture to hoals in Memory.

My Windows 2000 System with 1GB Memory told me it was out of Memory after seeing a few 100 Pictures from the PictureShow.
I Would geas changing the JavaScript

from

function preLoadPic(index)
{
        if (Pic[index] != ''){
                window.status='Loading : '+Pic[index]
                preLoad[index] = new Image()
                preLoad[index].src = Pic[index]
                Pic[index] = ''
                window.status=''
        }
}

function runSlideShow(){
   if (xIE4Up){
            document.images.SlideShow.style.filter="blendTrans(duration=2)"
                document.images.SlideShow.style.filter= "blendTrans(duration=crossFadeDuration)"
      document.images.SlideShow.filters.blendTrans.Apply()
        }
        document.images.SlideShow.src = preLoad[j].src
        if (xIE4Up){
           document.images.SlideShow.filters.blendTrans.Play()
        }

        pos = j

        j = j + 1
        if (j > (p-1)) j=0
        t = setTimeout('runSlideShow()', slideShowSpeed)
        preLoadPic(j)
}


to

function preLoadPic(index)
{
                window.status='Loading : '+Pic[index]
                preLoad[index] = new Image()
                preLoad[index].src = Pic[index]
                window.status=''
}

function runSlideShow(){
   if (xIE4Up){
            document.images.SlideShow.style.filter="blendTrans(duration=2)"
                document.images.SlideShow.style.filter= "blendTrans(duration=crossFadeDuration)"
      document.images.SlideShow.filters.blendTrans.Apply()
        }
        document.images.SlideShow.src = preLoad[j].src


preLoad[j]=null

        if (xIE4Up){
           document.images.SlideShow.filters.blendTrans.Play()
        }

        pos = j

        j = j + 1
        if (j > (p-1)) j=0
        t = setTimeout('runSlideShow()', slideShowSpeed)
        preLoadPic(j)
}


wold help more for my Problem.

Thanks