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

w3wp.exe is consuming more memory for sharepoint site(shows in task manager)

what is the root casue of this issue ?

Please tel me the possible steps to resolve this issue ?


share|improve this question
    
How much more memory, exactly? –  James Love Oct 6 '11 at 9:14
    
Doesn't it stand to reason that a small asp.net site will take less memory than the whole of SharePoint? –  Kobi Oct 6 '11 at 9:30
add comment

3 Answers 3

Are you sure this a problem? Memory is there to be used after all. It might be just that people are using your application.

A common cause of memory leaks is the use of SPWeb and SPSite objects that are incorrectly managed. This usually becomes apparent by inpecting the ULS logs. Frequent app pool recycles are also an indicator.

Check out this article on correct disposal

If you suspect a component, you can run SPDisposecheck against the DLL and it will flag up any issues.

Do ensure you're not prematurely optimising. Also, memory is cheap - stick some more in, it'll save you grey hairs in the long run.

share|improve this answer
add comment

I have the same problem. I have reviewed my source code and find out the cause. Maybe it can help you.

My old source code

private void InitData()
        {
            SPWeb openWeb = null;

            if (!Utility.ContainsCurrentUser(SYS_Constant.Groups.SYS_ADMIN, SPContext.Current.Web.CurrentUser.LoginName))
            {
                SPSecurity.RunWithElevatedPrivileges(delegate
                {
                    using (var siteCollection = new SPSite(SPContext.Current.Site.ID))
                    {
                        using (var impersonateWeb= siteCollection.OpenWeb(SPContext.Current.Web.ID))
                        {
                            openWeb = impersonateWeb;

                        }
                    }
                });
            }
            InitSapmleData(openWeb);
        }

And the new one

private void InitData()
        {
            //SPWeb openWeb = null;

            if (!Utility.ContainsCurrentUser(SYS_Constant.Groups.SYS_ADMIN, SPContext.Current.Web.CurrentUser.LoginName))
            {
                SPSecurity.RunWithElevatedPrivileges(delegate
                {
                    using (var siteCollection = new SPSite(SPContext.Current.Site.ID))
                    {
                        using (var openWeb = siteCollection.OpenWeb(SPContext.Current.Web.ID))
                        {
                            //openWeb = impersonateWeb;
                            InitSapmleData(openWeb);
                        }// The memory is released here
                    }
                });
            }

        }
share|improve this answer
add comment

+1 with SHug, the first thing I always do in my development is to run SPDisposeCheck and fix all issues, also read SHug article on disposal, its a must on a sharepoint developer arsenal, you should learn it from heart.

share|improve this answer
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.