#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2010
    Posts
    4
    Rep Power
    0

    Memory leak, caching, or maybe something else?


    Hi,

    I am trying to figure out if my application has a memory leak in it. I use a library called PdfSharp, which I then have a bunch of my own code sitting on top of, to allow me to more easily use the library. I think PdfSharp may be the culprit, but im not sure.

    When I run a blank .aspx page sitting in its own app pool which has been freshly recycled, each time i refresh the page, the memory usage in "perfmon" goes up by about 100kb - its not a consistent amount, but its only quite small each time.

    I have turned the IIS cache off by adding a value to the registry key:
    HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/INetInfo/Parameters

    where the key/value is ObjectCacheTTL/0 which, from what i read should stop caching of any form in IIS?

    I would them assume that each time I refresh the page, the memory usage would stay the same as nothing has been cached and the DLL's are already loaded into memory?

    So why is the Private Bytes increasing each time I refresh?

    The reason I found this weird behaviour out was becuase I was trying to see if the library when used on its own (rather than with any of my "framework" style code plugging into the library) was causing the Private Bytes (i.e. unmanaged memory leak) on the w3wp.exe/app pool to keep going up, which it is. But when i commented out all my code, so it was just a blank .aspx page and I still get similar behaviour when i run (albeit on a smaller scale) then maybe its not a memory leak?

    Im only a bit of an IIS novice at the moment and am pretty stumpted with this, but hopefully someone can help me as my current workaround to the PdfSharp "memory leak" is recycling the app pool every 10 requests, which for the time being seems to be holding up. but a more solid solution would be better as we have a lot of users....

    I am running the code locally on a Vista machine running IIS6 if its any help.

    Thanks,

    Mike
  2. #2
  3. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,453
    Rep Power
    4539
    What version of IIS? What version of NET?
    ======
    Doug G
    ======
    Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
    --Alfred Bester
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2010
    Posts
    4
    Rep Power
    0
    Hi,

    Its IIS6 and .net 2.0

    Thanks,

    Mike
  6. #4
  7. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,453
    Rep Power
    4539
    My guess is something in the web page coding if there's a problem. As another guess, you may be seeing normal perfmon results where the allocated memory doesn't get released back to the OS immediately, kind of like how sql server hogs memory and doesn't release it back to the OS until some limit is reached.

    I'm not familiar with any registry tweaks and IIS, but if you've done much manual registry editing you may have introduced some subtle problem. In my environment I've never found the need to visit registry keys for IIS.
    ======
    Doug G
    ======
    Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
    --Alfred Bester
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2010
    Posts
    4
    Rep Power
    0
    Hi,

    I only added the reg key once this had already started happening, to try and stop it. As for the code, its all commented out, so i cant see that being a problem.

    Maybe it is like SQL server....

    Thanks,

    Mike
  10. #6
  11. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,453
    Rep Power
    4539
    Sorry I can't help, I'm not familiar enough with the innards of IIS or IIS low-level debugging.

    I do seem to recall reading something in IIS5 days saying that IIS internal cache doesn't re-use pages between calls but will open a new cache buffer for each page call. Just guessing, but this may be what you're seeing (although I don't know if this info is even correct).
    ======
    Doug G
    ======
    Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
    --Alfred Bester

IMN logo majestic logo threadwatch logo seochat tools logo