Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Failed to allocate memory V2
#1
Hey peeps!
I have this code that I made and I'm having trouble because after it runs for several times I get this error that it failed to allocate memory.
My code is kinda simple but it's pretty heavy.
Can anyone help me with this problem?

Function test
Code:
Copy      Help
rep
,out "inicio-uma"
,str tempBRA tempBRAfinal tempBRAformat
,str fBRAE="S:\GS\SN SS GNOC\Projects\TIM\Menu TIM\remote\meteo\tempBRA.csv"
,str fBRAT="S:\GS\SN SS GNOC\Projects\TIM\Menu TIM\remote\meteo\tempBRAf.txt"
,fBRAE.all
,fBRAT.all
,HtmlDoc dBRA
,dBRA.SetOptions(2)
,dBRA.InitFromWeb("http://br.weather.com/agora/BRXX0043:1:BR")
,str sBRA=dBRA.GetText
,sBRA.setfile(fBRAE);err
,ExcelSheet esBRA.Init("tempBRA" 8 "S:\GS\SN SS GNOC\Projects\TIM\Menu TIM\remote\meteo\tempBRA.csv");err
,tempBRA=esBRA.Cell("A15");err
,tempBRAfinal.format("%0.2s" tempBRA)
,tempBRAformat=F"{tempBRAfinal} C"
,tempBRAformat.setfile(fBRAT);err
,1
,str tempBLM tempBLMfinal tempBLMformat
,str fBLME="S:\GS\SN SS GNOC\Projects\TIM\Menu TIM\remote\meteo\tempBLM.csv"
,str fBLMT="S:\GS\SN SS GNOC\Projects\TIM\Menu TIM\remote\meteo\tempBLMf.txt"
,fBLME.all
,fBLMT.all
,HtmlDoc dBLM
,dBLM.SetOptions(2)
,dBLM.InitFromWeb("http://br.weather.com/agora/BRXX0032:1:BR")
,str sBLM=dBLM.GetText
,sBLM.setfile(fBLME);err
,ExcelSheet esBLM.Init("tempBLM" 8 "S:\GS\SN SS GNOC\Projects\TIM\Menu TIM\remote\meteo\tempBLM.csv");err
,tempBLM=esBLM.Cell("A15");err
,tempBLMfinal.format("%0.2s" tempBLM)
,tempBLMformat=F"{tempBLMfinal} C"
,tempBLMformat.setfile(fBLMT);err
,1
,str tempRCE tempRCEfinal tempRCEformat
,str fRCEE="S:\GS\SN SS GNOC\Projects\TIM\Menu TIM\remote\meteo\tempRCE.csv"
,str fRCET="S:\GS\SN SS GNOC\Projects\TIM\Menu TIM\remote\meteo\tempRCEf.txt"
,fRCEE.all
,fRCET.all
,HtmlDoc dRCE
,dRCE.SetOptions(2)
,dRCE.InitFromWeb("http://br.weather.com/agora/BRXX0032:1:BR")
,str sRCE=dRCE.GetText
,sRCE.setfile(fRCEE);err
,ExcelSheet esRCE.Init("tempRCE" 8 "S:\GS\SN SS GNOC\Projects\TIM\Menu TIM\remote\meteo\tempRCE.csv");err
,tempRCE=esRCE.Cell("A15");err
,tempRCEfinal.format("%0.2s" tempRCE)
,tempRCEformat=F"{tempRCEfinal} C"
,tempRCEformat.setfile(fRCET);err
,1
,str tempMAN tempMANfinal tempMANformat
,str fMANE="S:\GS\SN SS GNOC\Projects\TIM\Menu TIM\remote\meteo\tempMAN.csv"
,str fMANT="S:\GS\SN SS GNOC\Projects\TIM\Menu TIM\remote\meteo\tempMANf.txt"
,fMANE.all
,fMANT.all
,HtmlDoc dMAN
,dMAN.SetOptions(2)
,dMAN.InitFromWeb("http://br.weather.com/agora/BRXX0146:1:BR")
,str sMAN=dMAN.GetText
,sMAN.setfile(fMANE);err
,ExcelSheet esMAN.Init("tempMAN" 8 "S:\GS\SN SS GNOC\Projects\TIM\Menu TIM\remote\meteo\tempMAN.csv");err
,tempMAN=esMAN.Cell("A15");err
,tempMANfinal.format("%0.2s" tempMAN)
,tempMANformat=F"{tempMANfinal} C"
,tempMANformat.setfile(fMANT);err
,out "fim-uma"
,wait 3000

Thanks!! Big Grin
#2
Scripts in this web page leak much memory. From all my tested web pages, only this page has this problem.
Workarounds:
1. Use SetOptions(3). It disables scripts. However then you may not get correct data.
2. Run HtmlDoc code in separate process that exist when gets web page text and saves in file.
3. Use other web page.
#3
I tried to close the excelsheets at the end of the code and no problem until the moment.
The option that you gave me didn't work 'cause I lost the info that I wanted, but thanks!
I'll let it run till the end of the day and let you know how it goes.

Thanks again! Smile


Forum Jump:


Users browsing this thread: 1 Guest(s)