Search

Wrong information when querying 64-bit process memory usage from 32-bit process by Luboš Kresta

Closed
as Won't Fix Help for as Won't Fix

1
0
Sign in
to vote
Type: Bug
ID: 767083
Opened: 10/11/2012 11:11:46 AM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
When querying System.Diagnostics.Process.PrivateMemorySize64 for a 64-bit process from 32-bit process, the maximum value reported is 4294967295 (2^32 - 1), even if actual memory usage of the process is higher. When querying the same information from 64-bit process, the value returned is correct.
Details (expand)

Visual Studio/Team Foundation Server/.NET Framework Tooling Version

.NET Framework 4.5

Steps to reproduce

1. Write a sample managed application allocating over 4 GB memory, build it as x64 and run it.
2. Write sample managed application II querying memory usage of a process given its PID using System.Diagnostics.Process.PrivateMemorySize64 property.
3. Build the second sample as x64 and run it with PID of the first application instance.
4. Build the second sample as x32 and run it with PID of the first application instance.

Product Language

English

Operating System

Windows 7 SP1

Operating System Language

English

Actual results

Step #3 yields correct memory usage information (e.g. 4416671744 when allocating like this
            List<byte[]> content = new List<byte[]>();

            for (int index = 0; index < 4 * 1024; ++index)
            {
                content.Add(new byte[1024 * 1024]);
            }
)
Step #4 yields "4294967295" as the memory usage.

Expected results

Both #3 and #4 step should yield the same result.
File Attachments
File Name Submitted By Submitted On File Size  
ProcessMemory_pkg.zip 10/12/2012 7 KB
Sign in to post a comment.
Posted by Microsoft on 2/22/2013 at 2:44 PM
Thank you Lubos for raising the issue to our attention.

Unfortunately, we are unable to implement the fix for this problem in the current version of .NET 4.5. We are however, keeping the bug so that we can consider it in a future version of the product. Thank you for reporting.
Posted by Microsoft on 10/16/2012 at 4:19 AM
Thanks for your update. We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Luboš Kresta on 10/12/2012 at 1:59 AM
Added a solution with sample projects I used.
- Open the sln
- Make sure you have x64 selected as platform
- Run "ProcessMemory" without debugging
- Find out its PID (via Process Explorer etc.)
- Go to "ProcessMemoryUsage" properties -> debug and set the PID as sole command line argument
- Run the "ProcessMemoryUsage"

Solution configuration forces the former to run as x64 and the latter to run as x86 and both report the memory usage of the first process. The number reported differs as stated in original post.
Posted by Microsoft on 10/11/2012 at 9:56 PM
Thank you for submitting feedback on Visual Studio and .NET Framework. In order to efficiently investigate and reproduce this issue, we are requesting additional information outlined below.

Could you please give us a demo project to demonstrate this issue so that we can conduct further research?

We look forward to hearing from you with this information.

Microsoft Visual Studio Connect Support Team
Posted by Microsoft on 10/11/2012 at 11:51 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.