ANTS Memory Profiler - 7.1
Profiling SharePoint - ANTS Memory Profiler
ANTS Memory Profiler can profile managed code that runs on a Microsoft SharePoint server because Microsoft SharePoint 2007 is implemented as an ASP .NET web application.
Though ANTS Memory Profiler was not designed to support SharePoint 2010 profiling, a workaround exists that may let you profile managed code running on a SharePoint 2010 server. For details, see Profiling SharePoint 2010.
Follow the procedure for profiling an ASP.NET web application on IIS.
If you encounter difficulties, the most likely cause is that ANTS Memory Profiler cannot read from the directory to which SharePoint is writing data. To fix this:
- Create a temporary directory
- If you are not on a sensitive system, allow full read/write access to this temporary directory to all users. If you are on a sensitive system, ensuring that the local system account has read/write access should suffice.
- Use Control Panel to add a new environment variable. The variable must be called RGIISTEMP and the value is the path to the temporary directory you just created.
For more information, see Profiling SharePoint with ANTS Performance Profiler 5.2. (The information in this post is also valid for ANTS Memory Profiler 7.1.)
Known memory problems with SharePoint
SharePoint's API is still partly unmanaged; if you have been experiencing memory problems with SharePoint, you might find the following MSDN articles helpful:
- Common Coding Issues When Using the SharePoint Object Model
- Using disposable Windows SharePoint Services objects
Troubleshooting SharePoint profiling
Security features in ASP.NET may cause problems on some systems. In that case, follow the instructions below:
Information you will need
Before profiling a SharePoint 2007 site, you will need to know the following information for the site collection you want to profile:
- the URL for the site collection
- the TCP port it runs on
- the name of the primary site collection administrator
- the primary site collection administrator's password
To find the name of the primary site collection administrator:
- Open the SharePoint Central Administration website using the Start menu item.
- Click the Application Management tab.
- Under SharePoint Site Management, click Site Collection Administrators.
- From the dropdown list, select the name of the site collection hosting your web part.
- Note the account set in the Primary Site Collection Administrator box.

Grant permissions
The primary site collection administrator must have permission to launch an IIS 6 worker process. To grant this permission:
- Open Administrative Tools then open Local Security Policy.
- Under Local Policies, click User Rights Assignment.
- Double-click Act as part of the operating system and add the primary site collection administrator's account.

- Double-click Impersonate a client after authentication and add the primary site collection administrator's account.
- Open a command prompt and run
gpupdate /force
to enforce the new settings. - Open Administrative Tools and go to Computer Management.
- Under Local Users and Groups, open Users.
- Double-click the primary site collection administrator's account and open the Member Of tab.
- Add the Administrators group.

The ANTS Memory Profiler 7.1 Service must use the primary site collection administrator's account when it starts. To configure this:
- Open Administrative Tools then open Services.
- Double-click the ANTS Memory Profiler 7.1 Service.
- Click the Log On tab.
- Select This Account and enter the primary site collection administrator's username and password.
- Click OK.
- If the status of ANTS Memory Profiler 7.1 Service is Started, right-click the service and click Restart.

Ensure that compilation will be in DEBUG configuration (IIS 6)
(Instructions for IIS 7 are below)
To profile a SharePoint collection, the ASP .NET compilation must be done in DEBUG configuration. This will allow ANTS Memory Profiler to locate the source code for any web parts or other extensions you have written for the site collection. DEBUG configuration also removes some unmanaged code restrictions that prevent profiling and stop the site from timing out.
To set DEBUG configuration, you must know the physical path to the root of the site collection website.
To find this path:
- Open Administrative Tools.
- Open Internet Information Server (IIS) Manager.
- Right-click the website containing the site collection then click Properties.
- Open the Home Directory tab.
- Note the path in the Local path box.

You must now locate and edit the web.config file for the site collection using notepad.exe (or other text-editor).
- Use Windows Explorer to navigate to the site collection root's physical path.
- Right-click the web.config file.
- Open the web.config file using a text editor. Search for the text 'Debug'.
- Change
<compilation batch="false" debug="false">
to<compilation batch="false" debug="true">. - Save the file.

Continue reading at the step 'Copy PDBs and web part DLLs to the app_bin directory' below.
Ensure that compilation will be in DEBUG configuration (IIS 7)
To set the application in DEBUG configuration in IIS 7:
- Load IIS Manager.
- Click the web application you want to profile.
- Click the .NET Compilation option.
- Under the Behavior group, set Debug to True.
Copy PDBs and web part DLLs to the app_bin directory
To filter out all methods except those run by your code when viewing the profiling results, you must copy the relevant files into the site's app_bin directory. To do this:
- Copy all PDB files and any web part DLLs used by your site to the Clipboard.
- Use Windows Explorer to navigate to the site collection root's physical path.
- Open the app_bin directory.
- Paste all PDB files and any web part DLLs used by your site into this directory.
Start profiling
- If the Internet Information Services Manager is not already displayed, open Administrative Tools and open Internet Information Server (IIS) Manager.
- Stop the website.
- Start ANTS Memory Profiler.
- Under Choose application type to profile, click ASP .NET Web Application (hosted in IIS).
- Enter the path to the ASP .NET web application that hosts your site collection. The path should be in the following format:
http://server:port/
The server is the name of the local server and the port is the TCP port that the web application normally runs on. If the site collection is on the root virtual directory for the site, you must include the trailing slash. - To profile your application without restarting IIS select Unused port and enter a new port number. If your application uses hard-coded port numbers, your application will not work and you must chose Original port instead.
- Use your SharePoint 2007 Site Collection as normal. Any additions that you have coded, such as web parts and lists, will be reflected in the ANTS Memory Profiler results if these objects have been accessed.

Was this article helpful?
ANTS Memory Profiler
- Installation error 5100 when installing ANTS Performance Profiler and ANTS Memory Profiler
- Attach to process unavailable with some anti-virus software
- Fragmentation notices in ANTS Memory Profiler 7
- The snapshot failed because .NET did not report every referenced object... manually switch your application to the workstation garbage collector.
- Profiling Sharepoint 2010
- Upgrading to ANTS Memory Profiler 7
- Memory leaks observed when profiling Windows Presentation Framework (WPF) applications
- Windows service profiling fails if the service uses a system account
- Log files
- The type initializer for 'y.layout.hierarchic.ClassicLayerSequencer' threw an exception
- Forcing your application to use .NET 4
- System.EntryPointNotFoundException (Versions: 3,4 only)
- Failed to CoCreate Profiler error profiling a Windows service
- ANTS Profiler code instrumentation method
- Add-in fails to load when using RunAs to start Visual Studio as another user
- Profiling unit tests using Nunit
- Can I profile Compact Framework applications?
- Profiling a SharePoint 2007 Web Part
- Profiling IIS web applications that need to run under the SYSTEM account
- Profiling a web application hosted in IIS on a fixed TCP port
- Profiling client-side XBAP .NET applications
- ANTS Profiler prompts for location of source code which is not your own source code
- ANTS menu remains in Visual Studio after uninstall of ANTS Profiler
- Profiling a web application needing to run as the Network Service account
- Cannot start COM+ application via Remote Desktop
- Profiling BizTalk applications
- Profiling Microsoft Office managed-code add-ins
- The system cannot find the file specified
- Error Stopping IISAdmin profiling IIS web application on Windows XP
- ANTS Memory Profiler total size of all objects does not match the memory footprint of an application
- Creating a global debugging symbols (PDB) directory
- Using the add-in to profile solutions containing more than one project
- Application recycling causes incomplete results and other errors when profiling ASP .NET
- (version 5) Support for profiling Silverlight applications
- Couldn't open metabase error when profiling ASP .NET hosted in IIS
- Failed to coCreate Profiler on ASP .NET web application
- HTTP error 404.17 profiling ASP .NET 1.1 on IIS 7
- Performance counters missing from results
- ANTS Profiler restarts IIS
- Please specify a valid URL message profiling ASP .NET
- Operation could destabilize the runtime error profiling ASP .NET
- IIS ceases to work after profiling web applications
- ANTS Profiler has been split into two distinct programs
- Problems with ANTS Memory Profiler 5 and multiple AppDomains
- System.ArgumentOutOfRangeException or CouldNotMapFileException errors in Memory Profiler 5
- Windows Installer errors 1603 and 2738 occurring during installation
- Unable to coCreate Profiler error profiling any application
- General information about "Private Bytes"
- Profiler stopping while profiling an in-browser Silverlight application
- Error: 'Could not load file or assembly vjslib'
- "No Disk" error occurring while profiling application
- Silverlight out-of-browser profiling stops with no results
- Memory Profiler failing to profile web applications with "unable to connect to server"
all products
- Some Red Gate products identified as containing a trojan by Anti-Virus software
- Activation may fail with Unknown Error -1
- Product uses web help although a CHM file is available locally
- Argument exception resulting from missing environment variable
- Check for updates may fail when used through proxies
- 'Unidentified Publisher' error when repairing or uninstalling
- Licensing activates product as standard edition
- Moving Red Gate software products to another machine
- Red Gate tools log locations
- The application UI opening slowly when there is no internet access
ANTS Memory Profiler
- Activating your products
- Activating your products
- ANTS Memory Profiler release notes - version 6.xx
- ANTS Memory Profiler release notes - version 7.xx
all products
- Red Gate product acknowledgements
- Activating your products
- Activating your products
- Red Gate bundle history
- Check for updates
- Troubleshooting Check for Updates errors
- Current versions
- Deactivating your products
- Installing Red Gate products from the .msi file
- Requesting additional activations
- Serial numbers for bundles
- Reactivating using a different serial number
- Extending your trial
- Finding your serial numbers
- Moving a serial number from one computer to another
- No response received for manual activation
- Licensing and activation resources
- Licensing and activation resources
- Troubleshooting licensing and activation errors
- Licensing and activation FAQs
- Red Gate tools log file locations
- Download old versions of products
- Download product prerequisites & utilities
- Support & upgrades
- Upgrading your software
- Upgrading FAQs

Understanding memory problems