Thanks go to André for pointing out the unload call!

On Jan 30, 2008, at 9:01, Michael Kroll <[EMAIL PROTECTED]> wrote:

Hi,

since I have full control over the servlet providing the images I was now able to reduce the amount of memory to a minimum. First I added an unload() call to my view, before I start requesting the new image and I added additional HTTP Headers hoping that the browser is not storing the images.

Finally the unload call did the trick. :-)

Thank's,
Michael.

Am 30.01.2008 um 14:28 schrieb P T Withington:

To the best of my knowledge, we (from the client side) have no control over the browser's cache. Internally we do something very like you do, attaching a random query string to 'break' the browser's cache (that is, to make the browser fetch a new copy).

Your image _server_ has to be the one to tell IE not to cache your images using the cache-control headers:

http://support.microsoft.com/kb/234067

On 2008-01-30, at 07:32 EST, Michael Kroll wrote:

Hi all,
today I was trying to fix a problem with my image distribution app while it consumes lots of memory. In my case I need to display lots (500+) images per patient study which are loaded from a webserver.

I'm still in the dhtml boat and I'm currently testing my app agains build 7833 of OL4.1.x.

After some search in the OL Forum and in the book OL in Action I tried to use setSource() with its additional cache parameter without luck. My app does is using a timestamp inside the image url to ensure that the image is not loaded from the browsers cache. The images are not loaded from the browsers cache, but they are stored there :-(

I tried to specify setSource("myUrl", "none") without luck. The memory usage in WindowsXP taskmanager is still growing. Is the cache option not working, or am I missing something?

Please find attached my sample code showing this issue. Maybe I need to file a Jire. Could someone please review it and tell me if I need to add it or jira or how to fix?

<canvas height="100%" width="100%" debug="false">

   <simplelayout axis="y" spacing="10" inset="10"/>

   <attribute name="cnt" type="number" value="0"/>

   <view name="imagecontainer" x="${parent.width/2 - this.width/2}"
width="512" height="512" bgcolor="#000000">
       <view name="image" id="imageviewport" stretches="both"
           x="${parent.width / 2 - this.width / 2}"
           y="${parent.height / 2 - this.height / 2}">
       </view>
   </view>

<view name="imagecontrolview" x="${parent.width/2 - this.width/ 2}">
       <simplelayout axis="x" spacing="10"/>
       <button text="Start">
           <handler name="onclick">
               <![CDATA[
                   this.onclick.clearDelegates();
                   this.del = new LzDelegate(this,
"stopTimer");
                   this.del.register(this, "onclick");
                   parent.time.updateTimer(this);
               ]]>
           </handler>
           <method name="stopTimer">
               <![CDATA[
                   this.setAttribute("text", "Start");
                   parent.time.del.disable();
                   this.onclick.clearDelegates();
                   this.del = new LzDelegate(this,
"restartTimer");
                   this.del.register(this, "onclick");
               ]]>
           </method>
           <method name="restartTimer">
               <![CDATA[
                   this.setAttribute("text", "Stop");
                   parent.time.del.enable();
                   parent.time.updateTimer(this);
                   this.onclick.clearDelegates();
                   this.del = new LzDelegate(this,
"stopTimer");
                   this.del.register(this, "onclick");
               ]]>
           </method>
       </button>

       <text name="time" resize="true"
           fontsize="14" fontstyle="bold">

           <method name="updateTimer">
               <![CDATA[
                   canvas.loadImage();
                   if (typeof this.del == "undefined")
{
                       this.del = new
LzDelegate(this, "updateTimer");
                       LzTimer.addTimer(this.del,
100);
                   }
                   else
                       LzTimer.resetTimer(this.del,
100);
               ]]>
           </method>
       </text>
   </view>

   <method name="loadImage">
       <![CDATA[
           canvas.cnt++;
           canvas.imagecontrolview.time.setAttribute("text",
cnt);

           var d = new Date();
           var t = d.getDate() + "-" + (d.getMonth()+1) + "-" +
d.getFullYear() + "_" + d.getHours()
               + ":" + d.getMinutes() + ":" +
d.getSeconds() + "." + d.getMilliseconds();
           Debug.write("LoadImage: " + cnt);

canvas.imagecontainer.image.setSource("http://www.kroll-mobile.de/rw_common/
images/140x140shadow.png?ts=" + t);
           delete d;
           delete t;
       ]]>
   </method>

</canvas>

KInd regards,
Michael.



Reply via email to