fremag / MemoScope.Net

Dump and analyze .Net applications memory ( a gui for WinDbg and ClrMd )
The Unlicense
691 stars 74 forks source link

Cannot dump memory on a vmware virtual machine? #204

Closed Guymestef closed 6 years ago

Guymestef commented 6 years ago

Hello,

As hinted with the issue title, I'm trying to dump the memory of a process running on a virtual machine. But I can't because I get not enough space on disk. The error is most probably due to the virtual memory size. As we can see on the process details, the virtual memory is very high:

image

I don't know if this amount is right or not...

For information, if I dump the process with the task manager, the dump is around 400Mo.

Env: OS: Windows Server 2012 R2 Standard x64 (VM on a vmware server) Process: dotnet.exe

fremag commented 6 years ago

Hello,

I tried to dump a process running on a VM (Windows Server 2016 / HyperV) and had no issue: I could dump it and load the data in Memoscope. I'm sorry but I have no idea why it fails in your environment. I agree that 2 Tb of virtual memory is uncommon and maybe the root of the problem but I don't know why TaskManager can dump it while Memoscope fails...

Guymestef commented 6 years ago

Maybe the difference is that MemoScope is checking if there is enough space on disk to save the dump and use the total memory size (so here > 2Tb) and Task manager only the memory currently used by the process (here ~330Mb) Anyway, since I was able to dump via Task manger and open the dump with MemoScope, it's not a big problem. Thanks for the quick reply

fremag commented 6 years ago

You're right. I forgot I wrote a check about available disk space based on virtual memory

if (proc.Process.VirtualMemorySize64 >= driveInfo.AvailableFreeSpace)
{
    Log($"Can't dump: not enough space on disk ! Proce VirtualMem: {proc.Process.VirtualMemorySize64:###,###,###,###}, available disk space: {driveInfo.AvailableFreeSpace:###,###,###,###}, drive: {driveInfo.Name}", LogLevelType.Warn);
    return;
}

Maybe I should use PrivateMemorySize64 or PagedMemorySize64 instead. Thanks for your help and feedback.

LorenzoFarro commented 2 years ago

Just wanted to add that I'm seeing the same thing. Happy to provide more information if you decide to ever look further into it. Otherwise just adding to the conversation. Working on Windows Home 11, physical machine, total virtual memory ~ 40 gb. image