I hope any one can help me...thank you.

function Stock(){


$fp = fopen ("http://finance.yahoo.com/d/quotes.csv?s=0016.HK&f=sl1d1t1c1ohgv&e=.csv","r");

$data = fgetcsv($fp, 1000, ', ');
fclose($fp); 

return array_values($data);

}  	
function GetStock(){

window.setInterval("agent.call('','Stock','Stock_Callback');",3000);

}

Detail: I want to call the php stock() function every 3 sec to update my stock value in my page. My web is use ajax. My target is make the stock value auto update and dont need refresh all the page.

Problem: i found that the IEXPLORE.EXE memory is increase every 3 sec..until the brower tell me the memory is full... I think the fclose() function is not work.. Can i fixe it???

    PHP uses Apache or PHP's memory, not Internet Explorer's. The Java Virtual Machine, on the other hand, will use IE's memory. Your culprit is the JVM, not PHP.

    You'll probably need to find a way of importing the PHP script's results into known variables in Java so the information is overwritten in memory. Think of in terms of an "overwrite" instead of an "append" action.

    Three seconds also seems really overkill. You're putting a lot of strain on the servers involved.

      banzaimonkey wrote:

      PHP uses Apache or PHP's memory, not Internet Explorer's. The Java Virtual Machine, on the other hand, will use IE's memory. Your culprit is the JVM, not PHP.

      You'll probably need to find a way of importing the PHP script's results into known variables in Java so the information is overwritten in memory. Think of in terms of an "overwrite" instead of an "append" action.

      Three seconds also seems really overkill. You're putting a lot of strain on the servers involved.

      Thank you reply first~ After i see you said, that mean the fclose() is no bug,it is work. it is really close the file not cause the memory increase??

      function Stock_Callback(obj){
      
      var htmlOutput = document.getElementById("stock_bd");			
      		var html = [];				
      
      html[html.length] = '<table border="1"><tr><td>'+obj[3]+'</td><td BGCOLOR="red" >'+obj[8]
      
      +'</td></tr></table>'
      
      document.getElementById("stock_bd").innerHTML = '<ul>'	+html.join('')+'</ul>';
      
      }
      

      You call me use "over write", so i need to change my code in Stock_callback(obj) ..right?? The php side function code is ok,not need to change..right?

      i will change the time to 1 min...i think it will more good.

        Yes, IE6 has a notorious memory leak when a page refreshes itself (Google for Javascript "Internet Explorer" "memory leak" to see just how notorious).

          Weedpacket wrote:

          Yes, IE6 has a notorious memory leak when a page refreshes itself (Google for Javascript "Internet Explorer" "memory leak" to see just how notorious).

          Thank you, your information is very good. But i have still no ideal to change my code, you or anyone can give me more hits to corret this problem??THX

            Well, you can try using [url=http://********firefox.com/]Firefox[/url] to see if you have the same problems...

              Or have a look at some of those links that Google finds..... if you're pressed for time, add "+solution" to the search terms.

                Weedpacket wrote:

                Or have a look at some of those links that Google finds..... if you're pressed for time, add "+solution" to the search terms.

                THX u soultion. i think i know the wrong in where... every time i use the AjaxAgent to handle the javascript side, the ie momory leak is occur. The function Stock_Callback(obj){} is the main point... The obj is dont renew the array to recieve the second array value from the php side.

                  Write a Reply...