Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

So I read through another post here http://www.sharepointoverflow.com/questions/1047/disposal-of-spwebs-created-using-spsite-openweb.

Currently I only dispose of the SPSite object, and from my understanding whe SPSite disposes any opened SPWeb should dispose as well. It appears best practice is to dispose of each SPWeb as well. I will do so.

My reason for this post is this: what would a memory leak look like? I have a timer job which runs every 2 minutes and processes some list items. Again, i am only disposing of the SPSite object, not the SPWeb object. After letting it run for about a week on dev, the sqlserver.exe process was around 1.7GB of used memory. SharePoint started to error Out of Memory. I have since restarted SQL and it's down to 320MB of memory. I don't know how much it was before I installed the timer job, but we weren't getting these errors then.

Am I seeing a memory leak in sqlserver due to me not closing SPWeb? Or would a SharePoint memory leak occur in the w3wp process? Any clarity is greatly appreciated!

Thanks,

share|improve this question
add comment

1 Answer 1

up vote 5 down vote accepted

A memory leak will manifest itself in whatever is the host process for the code which has the leak. In the case of SharePoint code, this won't be the SQL process - most likely what you're seeing here is simply down to the fact that SQL generally consumes as much memory as it can (i.e. whatever isn't being scavenged/used by other processes). You can peg it though if you wish, I sometimes do this (e.g. on dev VMs).

So you might see a leak due to SharePoint code in:

  • w3wp.exe for code running from a web page
  • Owstimer.exe for a timer job
  • STSADM.exe for a custom STSADM command
  • The process for a custom exe e.g. in the case of a console app

..etc..

share|improve this answer
    
I guessed as much. Thanks a lot! –  David Lozzi Feb 17 '10 at 19:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.