Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

How to Dispose SPGroup objecti am using

$
0
0

i am using following code

 foreach (SPGroup objSPGroup in pobjSPUser.Groups)

in ULS log this is throwing memory leak issue

An SPRequest object was not disposed before the end of this thread.  To avoid wasting system resources, dispose of this object or its parent (such as an SPSite or SPWeb) as soon as you are done using it.  This object will now be disposed.  Allocation Id: {E4D2962F-7E17-494F-AD56-6A73B2E6E3E9}  This SPRequest was allocated
 at   
 at Microsoft.SharePoint.Library.SPRequest..ctor()    
 at Microsoft.SharePoint.SPGlobal.CreateSPRequestAndSetIdentity(SPSite site, String name, Boolean bNotGlobalAdminCode, String strUrl, Boolean bNotAddToContext, Byte[] UserToken, String userName, Boolean bIgnoreTokenTimeout, Boolean bAsAnonymous)   
 at Microsoft.SharePoint.SPWeb.InitializeSPRequest()    
 at Microsoft.SharePoint.SPGroupCollection.InitGroups(Boolean fCustomUsers, String[] strNames, Int32[] groupIds)    
 at Microsoft.SharePoint.SPGroupCollection.Undirty()    
 at Microsoft.SharePoint.SPBaseCollection.GetEnumerator()    
 at Winshuttle.eShuttle.ApplicationPages.DataAccessLayer.RoleDefinition.#Y5b.#81c()

SPgroup does not implement IDispsable .I think Sharepoint inside SPgroup creating spweb object.


Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>