Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Join Date
    Aug 2002
    Location
    Netherlands
    Posts
    11

    Unanswered: Memory leak in Record Set?

    Hello everyone,

    I have a very strange and reproduceable error in ASP.

    The thing is that whenever I fire an double query to a database to collects a recordset, the memory useage on inetinfo.exe increases to unknown heights. (when I constantly refresh the page around 50 times the total memory useage can go up as high as 80% of the total available in the machine, 1gb internal mem.)

    I close all open connections and release all objects from memory.

    'sConnectString = userid and password


    sqlstr = "SELECT * FROM Dimensions WHERE Name = " & Dimension
    RS.Open sqlstr, "provider=DWServer.DWprovider.1;"&sConnectString,2 ,2
    OffgridMember = RS("OffGridMember")
    RS.close
    Set RS = Nothing


    'Get name of selected offgridmember
    sqlstr = "SELECT * FROM Members WHERE UniqueName = [[" & OffGridMember & "]]"
    RS.Open sqlstr, "provider=DWServer.DWprovider.1;"&sConnectString,2 ,2
    sOrgName = "Null"
    sOrgName = RS("Name")
    RS.close
    Set Rs = Nothing


    The strange thing is that whenever I comment out the second query the memory increase is gone. Not released, but no increase either. (Note, I've tested the query with different database types, including Oracle, MS Acces2000, Sql and all resulted in the same increase in memory.

    I am running this script on a machine with windows professional + sp3 + IIS5.
    Never try to beat your oponent. Let your oponent try to beat you.

  2. #2
    Join Date
    Feb 2002
    Location
    North Wales, UK
    Posts
    114
    By default IIS 5 should run the code in dlhost.exe unless you have set the application to run inside inetinfo.exe

    Have you checked what dllhost.exe is doing??
    J^ - web | email
    newsASP Developer

  3. #3
    Join Date
    Aug 2002
    Location
    Netherlands
    Posts
    11
    Hello JonathanB,

    Thanx for the reply. I'm blushing a bit for I defenitly mixed up things..I ment dllhost.exe and not inetinfo.exe (That's a different project DOH)

    As for additional info, I've checked the internet and found that msjet could be the problem as well with memory leaks regarding record set objects etc. Aparently version 2.6 could solve the problem but as of yet I've been unable to test that. I do not have enough user rights to install it at this moment.

    But regarding MsJet2.6 does anyone know what other problems that version could generate e.a. that the cure isn't worse than the solution. Microsoft states that with sp3 the memory leak issues regarding recordsets should be gone..

    Anyway, thanx in advance for more ideas.
    Never try to beat your oponent. Let your oponent try to beat you.

  4. #4
    Join Date
    Feb 2002
    Location
    North Wales, UK
    Posts
    114
    I discovered the same problem you have but in my case it was to do with blob fields in an M$ SQL database. Each application in IIS loads it's own copy of MDAC for database access and after so long it's leaked so much memory that the copy of MDAC in memory is useless, i.e. running a "SELECT * FROM table WHERE id = 1" would return nothing back.

    Here are my findings and some useful links I found on the subject: http://jon.devcore.co.uk/index.php?cat=17
    J^ - web | email
    newsASP Developer

  5. #5
    Join Date
    Aug 2002
    Location
    Netherlands
    Posts
    11
    Thanx for the additional info. The fun thing is that I've already looked at the exact document you point out. As for the IIS5 recycling tool, this could be a good solution but unfortunately the page that leaks memory eats up so fast, so many resources that the application crashes within hours..

    If I find more info I'll post it in here as well.. And of course, all ideas are more than welcome..
    Never try to beat your oponent. Let your oponent try to beat you.

  6. #6
    Join Date
    Feb 2002
    Location
    North Wales, UK
    Posts
    114
    Can you post your database connection open & close code for Access & SQL Server for me??
    J^ - web | email
    newsASP Developer

  7. #7
    Join Date
    Aug 2002
    Location
    Netherlands
    Posts
    11
    Sure,

    No problem.

    RS.Open sqlstr, "provider=DWServer.DWprovider.1;"&sConnectString,2 ,2

    do the query...

    rs.Close
    set rs = Nothing



    We've tried also creating an object like:
    connStr = "provider=DWServer.DWprovider.1;";"&sConnectSt ring
    Set con = Server.CreateObject("ADODB.Connection")

    Then to open the connection

    con.Open connStr

    do the queries

    con.Close
    Never try to beat your oponent. Let your oponent try to beat you.

  8. #8
    Join Date
    Feb 2002
    Location
    North Wales, UK
    Posts
    114
    The next time the site fails try "unloading" it's application through IIS - properties for the directory the site resides in. Let me know if that fixes the site at least temporarily.
    J^ - web | email
    newsASP Developer

  9. #9
    Join Date
    Aug 2002
    Location
    Netherlands
    Posts
    11
    hmm just found out there is yet another memory leak problem. (Different from the rs problem though)

    The other is related to some form of caching done by iis.

    Aparently java applets loaded used on a webpage are being cached and all information / page views that the applet will generate as well. Only unloading the applets will free up some memory. (We noticed that once a user looks at the same pages the applet was loaded on, the memory increase is no more.. But when 60% of the memory is used. The machine will crash due to the fact that sql cannot handle conections etc. due to lack of memory.

    Tested with both problems the unload application suggestion. With the rs problem around .5% of the memory was freed and with the applet problem nothing happened.

    Thanx again for suggestions.



    ----------
    "When a pc has a memory leak"
    Argh.... memory issues... they multiply... hmm... But I forgot why that was important... hmm... memmory, Is that a board game?
    Never try to beat your oponent. Let your oponent try to beat you.

  10. #10
    Join Date
    Feb 2002
    Location
    North Wales, UK
    Posts
    114
    Is this on the client PC or the server?? Applets run on the client's browser not on the server?
    J^ - web | email
    newsASP Developer

  11. #11
    Join Date
    Aug 2002
    Location
    Netherlands
    Posts
    11
    All is serverside.. The applets are cached server side in IIS..
    Never try to beat your oponent. Let your oponent try to beat you.

  12. #12
    Join Date
    Feb 2002
    Location
    North Wales, UK
    Posts
    114
    Applets are executed by the client's browser... it isn't executed by the web server at all? Or are you talking about java servlets?
    J^ - web | email
    newsASP Developer

  13. #13
    Join Date
    Aug 2002
    Location
    Netherlands
    Posts
    11
    Sorry for the confusion.

    The applet I am referring to is an object that is installed in the downloaded program files folder which uses different server side applications.

    Indeed javascript is executed client side, but this applet operates server side conecting to thbe database, retrieving information etc. The only part that is executed locally is caching the page that calls the applet / object with a couple of parameters...

    Anyway regarding the caching of the applet. A collegue of mine found a possible solution. Set the max allowable cache size for the IIS to 30% of the max int memory. This will result in the other processes that need server memory to continue as normal and possibly lower IIS dynamic caching from 30 secs (default) to 5 secs.. Will report on how this issue goes.

    Regarding the recordset leak.. not yet any solutions..
    Never try to beat your oponent. Let your oponent try to beat you.

  14. #14
    Join Date
    Jan 2004
    Posts
    5
    I've a similar situation case. Memory will not be released unless I restart SQL server. (I'm using ASP+ADO+SQL2000)

    I guess that the problem may occur by ADO (MDAC??) and I've installed the latest version (i.e. 2.8) but still problems here.

    Do anyone have any ideas about that?

  15. #15
    Join Date
    Feb 2002
    Location
    North Wales, UK
    Posts
    114
    The solution I found to work was to separate the code into multiple applications in IIS as each application loaded a separate copy of MDAC.
    J^ - web | email
    newsASP Developer

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •