asp classic - VBScript Out Of Memory Error -
i have classic asp crm built third party company. currently, have access source code , able make changes required.
randomly throughout day, after prolonged usage users, of pages start getting out of memory error.
the way application built, pages , scripts pull core functions global.asp file. in file embeds other global files well, error presented shows
out of memory
whateverscriptyoutriedtorun.asp line 0
line 0 include global.asp file. once error occurs, after unspecified amount of time error occurence subsides time begins reoccur again. how application written, , functions uses, , "diagnostics" i've done - seems common used function withholding data such recordset or of nature , not releasing properly. other users try use same function , fills causing error. way me clear error restart iis, recycle app pool, , restart sql server services.
needless say, myself , users getting annoyed....
i can't pinpoint error due actual error message presented being line 0 - there have no idea in 20k lines of code hanging up. thoughts or ideas on how isolate or @ least point me in right direction begin clearing up? there way me increase "memory" size vbscript? know there limitation set @ say...512k , can increase 1gb?
here things have tried:
- removing sql inline statements views
- going through several hundred scripts , ensuring every openconnection & openrecordset followed appropriate close.
- going through global file , commenting out large sql statements such applicationlog (a function writes executed query table).
- some smaller script edits.
common memory leak
you closing recordsets , connections good.
but deleting objects?
for example:
set adocon = new set rscommon = new 'do query stuff 'you this: rscommon.close adocon.close 'but do this? set adocon = nothing set rscommon = nothing
no garbage collection in classic asp, objects not destroyed remain in memory.
also, ensure closes/nothings run in every branch. example:
adocon.open rscommon.open etc 'sql query mydata = rscommon("condition") if(mydata) response.write("ok") else response.redirect("error.asp") end if 'close rscommon.close adocon.close set adocon = nothing set rscommon = nothing
nothing closed/destroyed before redirect empty memory of time not branches of logic lead proper memory clearance.
better design
also unfortunately sounds website wasn't designed well. structure classic asp as:
<% option explicit 'declare vars dim dim 'open connections set adocon... adocon.open() 'fetch required data rscommon.open strsql, adocon = rscommon.getrows() rscommon.close 'fetch else rscommon.open strsql, adocon = rscommon.getrows() rscommon.close 'close connections , drop objects adocon.close set adocon = nothing set rscommon = nothing 'process redirects if(condition) response.redirect(url) end if %> <html> <body> <% 'use data for(i = 0 ubound(this,2) response.write(this(0, i) & " " & this(1, i) & "<br />") next %> </body> </html>
hope of helped.
Comments
Post a Comment