Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AvailableVirtualMemory on IIS and Console application

I'm having problems to get the real value of AvailableVirtualMemory in IIS and a Console application, as detailed below:

When i run these commands on a Console application:

Console.WriteLine(String.Format("Memoria virtual total: {0}MB", My.Computer.Info.TotalVirtualMemory / 1024 / 1024))
Console.WriteLine(String.Format("Memoria virtual disponible: {0}MB", CDec(My.Computer.Info.AvailableVirtualMemory / 1024 / 1024)))

The Console shows me these results:

Memoria virtual total: 8388607.875MB
Memoria virtual disponible: 8388028.16015625MB

But when I run these commands on a .aspx page:

Response.Write(String.Format("Memoria virtual total: {0}MB", My.Computer.Info.TotalVirtualMemory / 1024 / 1024))
Response.Write("<br>")
Response.Write(String.Format("Memoria virtual disponible: {0}MB", CDec(My.Computer.Info.AvailableVirtualMemory / 1024 / 1024)))

The page shows me these results:

Memoria virtual total: 4095.875MB
Memoria virtual disponible: 3367.91796875MB

Why exists this difference on these different applications? I'm using a 64 bits operating system. I've searched for reasons in Google and here but I didn't found anything...
Thanks in advance.

like image 491
Fernando Andrs Sepulveda Silva Avatar asked Mar 09 '26 23:03

Fernando Andrs Sepulveda Silva


1 Answers

The application pool (and yes IIS Express even has these) for the site that your .aspx page is running in is probably configured for 32 bit mode which is why it's returning 4GB and 3.3GB respectively. Being a 32 bit process that's all it can see.

If you're running this page in the Visual Studio toy web server you'll get the same result because it's 32 bit only as well.

like image 172
Kev Avatar answered Mar 11 '26 12:03

Kev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!