Getting Out of Memory Exception when you have plenty of Memory/RAM available

19. May 2011

 

This is a great article on why having or adding more memory won’t fix your Out of Memory Exception.   Bottom line.. on a 32bit server you’re site will crash when it hits between 600MB and 800MB.  The amount varies based on what else is going on with the machine.   The solution? Basically, you have to upgrade to a 64bit OS or re-write your application.

 

Why adding more memory won’t fix your Out of Memory error by Edge

Copied from the article directly, in case it ever goes down.

-------------------------------------------

Here an interesting case. Consider there 2 scenarios:

Both are running the same website, both have the same amount of users connected.

Now imagine this website has a page to upload pictures, just like any regular photo-album website.

For some reason, at some point the users complain that they see an error page indicating out of memory error.

So, you wonder: How come? they are just uploading a photo to my website, and I still have plenty of memory in my server anyway.

Anyhow, you stop thinking about this and go for the easiest, quick and dirty solution: If the system tells me that my computer does not have enough memory then I just need to add more memory. Right?

And guess what? you still will get the error message.

That's a very common mistake. Having a machine with 10GB of memory does not mean you will have 10GB of memory available. I explain.

It does not matter if your computer or server has 512 MB, 1 GB, 2 GB, 4 GB or 8 GB of RAM. If your machine is a 32-bit machine it will only be able to see/manage 4 GB. That's mathematics, that's life, that's the way things are and you can't do nothing about it. A 32-bit machine can not do more than that.

Additional memory may increase your system performance, but it won't increase the memory availability. Sure your computer will use less the hard disk for swapping operations and will be able put more stuff in memory and start some programs faster, but 4GB is the limit; after this point the memory management module will start doing disk swap and to use the famous page file.

And here comes more bad news: Your Windows system on a 32-bit machine requires 2 GB allocated only for it.

So, if you have 4 GB installed, effectively you will have 2 GB only for applications; your windows will be using alone 2 GB.

So, what does out of memory means?

Well, according to some people at Microsoft, this limit for an average configuration is reached between 600 MB and 800 MB of utilization. That 800 number is NOT A RULE, is a baseline. Generally speaking the largest majority of configurations with website, .NET and SQL Server database might have a problem around this point. Of course, this can vary from system to system...as a matter of fact a system can be out of memory at just 600 MB.

Yes, it does sounds crazy. You look so happy now that you just bought a 4GB RAM notebook and your computer is breaking with just 800MB, hun?

Here is another point for you. Have you ever seen someone bragging that he/she bought a 10-megapixel camera and now he/she believes their pictures are going to be better because of this?

Well, guess what? Just like the number of megapixels in a camera box does not have much to do with picture quality, RAM memory does not have much to do with hard disk space.

That's a common mistake: People buy RAM as if they were buying a hard disk.

RAM usage needs to me continuous, unlike hard disk. A simple 5MB Microsoft Word document when saved in a hard disk can be split up in hundreds of pieces; When you open this file in memory, the RAM requires those 5MB to be allocated continuously.

Can you see now the reason for the 'out of memory' message?

Yes, it really means 'there is not enough continuous memory to place that file in memory'. Your system might have 2GB of RAM but unfortunately it might be too busy with stuff running and there is no enough continuous memory to put the picture you are uploading.

Yeah, you can not do much but you can buy a 64-bit machine then when you add more memory you can really use it more efficiently. And yes, we have Microsoft Windows systems for 64-bit machines.

If you do not want to buy a new system of upgrade you current server to a better version then you should think other solutions in the business process, such as to avoid users upload pictures with more than 1 MB in size to be uploaded.

.Net Framework, ASP.NET, Computers, Troubleshooting, Operating Systems, Microsoft, IIS And Hosting

The Add-in ‘xxxx' failed to load or caused an exception in SQL Management Studio

1. April 2011

 

And clicking on Yes to remove it, doesn’t help.  This is actually a permission issue from Vista and Windows 7 and up.

 

The service pack update to Windows Vista has been known to change permissions to the registry in a way that prevents user access to the information about installed classes: HKEY_CLASSES_ROOT. This prevents SQL Server Management Studio from loading the add-ins into the environment.


To correct this problem, it's necessary to assign permissions to the registry for the logged-in user.

  1. First open the Registry Editor (regedit.exe) using the "Run As Administrator" option.
  2. Right-click HKEY_CLASSES_ROOT and select "Permissions", and give the logged-in user full control.
  3. The following permissions needed to be added to HKEY_CLASSES_ROOT as well:
           -Users: read
           -System: full control
           -CREATOR OWNER: full control on subkeys only

Troubleshooting, Operating Systems

Change Binding Order on Network Adapters for Windows 7

1. April 2011

 

Good article on ordering the binding of your network adapters.  You can have your PC make sure it uses Wired over Wireless if you have both, or IP4 over IP6 if you have both.

Source: http://www.techrena.net/windows/view-change-network-adapter-card-priority-binding-order-windows-7/

Article has steps to check the current priority as well.

Changing Network Cards Priority in Windows:

You can change the network card priority in two ways in Windows:

Method #1:

To start with, I’ll introduce you the easier method first:

1. Go to Control Panel > Network and Internet (View network status and tasks)> Change adapter settings and now you will now be in “Network Connections” window.

image

2. Now press Alt button and a hidden menu will appear beneath the location bar.

image

3. Under the Advanced menu, click “Advanced Settings”.

image

4. You can now see the order of preference in which the connections are accessed by network services.

image

Use “Up” and “Down” buttons to move a network connection either up or down and thus changing the order of priority of connections.

Method #2:

And now let me introduce you the second alternative method, which is a bit laborious when compared to the first one:

1. Go to the “Network Connections” window by following the step 1 as detailed in the above step.

2. Right-click on the network connections for which you want to change the priority order and choose “Properties”. In my case, I wanted to change the interface metric for my wireless network card and hence I will proceed with the changing priority order for Wireless Network Connection under my network connections.

image

3. Now choose “Internet protocol Version 4 (TCP/IPv4)” and click on “Properties” button.

image

image

Click on “Advanced..” button in the IPv4 properties window.

4. Look for the “Automatic metric” option in the advanced TCP/IP settings window.

image

5. Uncheck against the “Automatic metric” option and enter some value other than 1 in the filed against “Interface metric” (as 1 will always be assigned to Microsoft Loopback adapter always) as shown:

image

Click OK and close all the windows.

You have now changed the priority of your network card interfaces.

Computers, Microsoft, Operating Systems

View the GAC like a normal File/Folder to Copy/Paste From/To the GAC

29. March 2011

 

Browse the GAC like any other file/folder structure.

You can simply go to,
HKLM\Software\Microsoft\Fusion

Create a DWORD value named "DisableCacheViewer" and set it to value 1.

Open another instance of windows explorer, explore to c:\windows\assembly

 

image

Computers, Programming, Operating Systems

Slow Remote Desktop

13. January 2011

These are the commands I ran to speed up Remote Desktop. Article is for Vista, but it applies to Windows 7 as well.  Run commands locally even if it’s just a particular server that is slow. Which makes you think it’s that server and not your machine.

Not sure if it applies to XP.

- Run a command prompt (cmd.exe) as an Administrator
- Type: netsh interface tcp set global autotuninglevel=disabled
Disable the autotunning feature in Vista completely, and fit and lock the RWIN receive window to default value 65536 bytes.
If you want to to re-enable it:
- Type: netsh interface tcp set global autotuninglevel=normal
In some cases you may need to use this command in addition to the above, but I didn't have to:
- Type: netsh interface tcp set global rss=disabled
Update! This command makes your network connection EVEN FASTER
Type: netsh interface tcp set global autotuninglevel=highlyrestricted
The reason is that this command will still "auto tune" your TCP connections, but not as drastically as 'normal' mode. It will allow the receive window to grow beyond the default value, but again it will do so very conservatively.

Source: http://blog.tmcnet.com/blog/tom-keating/microsoft/remote-desktop-slow-problem-solved.asp

Troubleshooting, Operating Systems ,

$35 laptop prototype or something from India coming soon! (Update)

23. July 2010

 

India is about to put out a computer that’s only $35!! Crazy!  Then drop the price to $10 a unit as it sells. Don’t know what the stats are other then it’s a Linux based machine but I’d buy 10 of them.

From the picture it kind of looks like a wallet and flexible.  Who’s been smudging up my screen!

“India has unveiled a $35 computer prototype as part of its program to provide connectivity to its students and teachers at affordable prices.”

“The ministry said the price would gradually fall to $10 a piece.”

“The Linux-based computer is equipped with an Internet browser, a PDF reader and several other facilities…”

Source: http://www.cnn.com/2010/WORLD/asiapcf/07/23/india.thirty.five.dollar.laptop/

 

Indian government minister Kapil Sibal unveils a prototype of the $35 computer.

 

Update:

Looks like it’s still in progress and more legit then the original post. http://news.cnet.com/8301-17938_105-20013370-1.html

 

  • OS: It was changed from Linux to Android.
  • Virtual Keyboard
  • Camera
  • Full Video Capability
  • Wi-Fi
  • 2GB Ram
  • Scheduled for Mid-2011

Operating Systems, Gadgets & Cool Stuff

How to enable Dreamscene or Video Wallpaper in Windows 7

23. April 2010

 

Original Post Here

Dreamscene was a feature introduced in Windows Vista that allowed users to have video wallpapers in the background. Microsoft seems to have replaced the Dreamscene feature from Vista with automatic changing wallpapers in Windows 7.  However by adding the Dreamscene files and making a few registry changes, Dreamscene can once again be enabled. Don’t worry if that sounded intimidating, we do have a file that does all for you [if you're on 32-bit.]

Note: I was unsuccessful in getting this to work on 64-bit Windows 7 Build 7048.

Installing Dreamscene:

1) First, you need to have Aero enabled. You’ll know Aero is enabled if you’re able to preview windows in your taskbar, use Aero Peek, or see the animation effects of windows minimizing. If you think Aero isn’t enabled, open the Start menu, and type in Aero.

How to enable dreamscene in Windows 7

Click on Find and fix problems with transparency and other visual effects and go through the wizard. The wizard will determine whether your computer is capable of having Aero on.

2) If you’re on 32-bit Windows 7, download the Windows 7 Dreamscene patch here

If you’re on 64-bit Windows 7, download this patch and follow the instructions in Important Readme.txt
Then skip Step 3.

3) Run the patch and let it do it’s thing. When it’s finished, explorer.exe will restart.
If it doesn’t restart, press Ctrl + Alt + Delete and click on Task Manager. Right click on explorer.exe and click on End Task. Then click on File, New Task, type in explorer.exe and press OK.

Setting video clips as your desktop background

4) Before you start adding videos, you need to make sure that your videos are in .wmv or .mpg format. If they are not one of those formats, you can download a free video converter here.

Converting a video is simple. Choose Add Video at the top left corner and choose your video of choice. The drop down-menu in the right side-bar will allow you to choose your codec. On my computer, .wmv videos worked properly while .mpg videos would not work with Dreamscene.

The bottom portion of the sidebar will allow you to change the video size or bitrate. If you are not sure what those options do, the only one you should worry about is video sizesince some videos may end up being too large and get cut off the screen.

How to enable Dreamscene or Video Wallpaper in Windows 7

When the video is finished converting, a new window will pop up. Right click your video and choose Open Destination File Location to locate the video. You can also access your converted videos at this directory:
C:\users\%username%\Documents\Any Video Converter\

How to enable Dreamscene or Video Wallpaper in Windows 7

Once you have converted the file, just right-click and select Set as Desktop Background and Dreamscene will begin to work.

Should you want to revert back to a stationery wallpaper, sometimes the stopped video will stay frozen as your wallpaper. To fix this, press Ctrl + Alt + Delete and click on Task Manager. Right click on explorer.exe and click on End Task. Then click on File, New Task, type in explorer.exe and press OK.

Note: Desktop icon text will become transparent sometimes. This is a bug that has yet to be fixed.

Operating Systems ,

Windows 7 Genuine Validation Fails on Genuine Install

15. April 2010

 

I was having problems trying to download XPMode because the website tries to validate your Windows 7 operation system.  Even though I activated successfully and I ran the MGA Diagnostic Tool locally and it said Genuine. It still failed the online check.

image

I even called Microsoft to see if they could figure it out. No luck. They tried the obvious stuff, re-entering my product key, re-activating.  They couldn’t figure it out. Even gave me a new product key and still no luck.  Then I told them I had to go.

Found the answer on my own..

I was getting Event Errors in my Application Log.

Source: CAPI2
Event ID: 257

The Cryptographic Services service failed to initialize the Catalog Database. The ESENT error was: -1011.

Then I caught online something on bypassing XP Genuine has to do with the Cryptographic services. Putting two and two together, I figured this error was the source of my problem.

After a little digging I found this article which gave me steps to wipe out my System Catalog Database. 

This fixed my error and allowed me to validate my windows online.

  1. Click Start, point to Administrative Tools, and then click Services.
  2. Right-click Cryptographic Services, and then click Stop.
  3. Click Start, and then click Computer.
  4. Navigate to %systemroot%\System32.

    By default, %systemroot% is located at C:\Windows.

  5. Rename the catroot2 folder to catroot2.old.
  6. In the Services snap-in console, right-click Cryptographic Services, and then click Start.

Operating Systems, Troubleshooting , ,

IIS7 Windows7/Server2008 ApplicationPoolIdentity Security Change from Network Service

31. March 2010

 

Yeah this one got me.. http://learn.iis.net/page.aspx/624/application-pool-identities/

The change microsoft made to have AppPool now run as “ApplicationPoolIdentity” instead of Network service.

So if you normally give Network Service rights needed to your webapp, you now have to stop doing that and change it to

IIS AppPool\DefaultAppPool

Or

IIS AppPool\<NAME OF YOUR APPPOOL>

End of that.

 

 

 

 

  1. Open Windows Explorer
  2. Select a file or directory.
  3. Right click the file and select "Properties"
  4. Select the "Security" tab
  5. Click the "Edit" and then "Add" button
  6. Click the "Locations" button and make sure you select your machine.
  7. Enter "IIS AppPool\DefaultAppPool" in the "Enter the object names to select:" text box.
  8. Click the "Check Names" button and click "OK".

By doing this the file or directory you selected will now also allow the "DefaultAppPool" identity access.

IIS And Hosting, Troubleshooting, ASP.NET, .Net Framework, Operating Systems , ,

EventID 4625 on Windows 2008 IIS7 Windows Authentication Error

22. March 2010

I was having wierd authentication issues on a Windows 2008 server with IIS7. I was trying to use Windows Authentication.  Worked fine from a remote location but failed when local on the server.

An account failed to log on.

Subject:
    Security ID:        NULL SID
    Account Name:        -
    Account Domain:        -
    Logon ID:        0x0

Logon Type:            3

Account For Which Logon Failed:
    Security ID:        NULL SID
    Account Name:        xxxxxx
    Account Domain:        xxxxxx

Failure Information:
    Failure Reason:        An Error occured during Logon.
    Status:            0xc000006d
    Sub Status:        0x0

Process Information:
    Caller Process ID:    0x0
    Caller Process Name:    -

Network Information:
    Workstation Name:    xxxx-xxxxxx
    Source Network Address:    ###.###.###.###
    Source Port:        49597

Detailed Authentication Information:
    Logon Process:       
    Authentication Package:    NTLM
    Transited Services:    -
    Package Name (NTLM only):    -
    Key Length:        0

This event is generated when a logon request fails. It is generated on the computer where access was attempted.

The Subject fields indicate the account on the local system which requested the logon. This is most commonly a service such as the Server service, or a local process such as Winlogon.exe or Services.exe.

The Logon Type field indicates the kind of logon that was requested. The most common types are 2 (interactive) and 3 (network).

The Process Information fields indicate which account and process on the system requested the logon.

The Network Information fields indicate where a remote logon request originated. Workstation name is not always available and may be left blank in some cases.

The authentication information fields provide detailed information about this specific logon request.
    - Transited services indicate which intermediate services have participated in this logon request.
    - Package name indicates which sub-protocol was used among the NTLM protocols.
    - Key length indicates the length of the generated session key. This will be 0 if no session key was requested

I found the solution on the MS Support site, Q89681.  Which suggested to turn off the LoopbackCheck.

To set the DisableLoopbackCheck registry key yourself, follow these steps:

  1. Set the DisableStrictNameChecking registry entry to 1. For more information about how to do this, click the following article number to view the article in the Microsoft Knowledge Base:

    281308 Connecting to SMB share on a Windows 2000-based computer or a Windows Server 2003-based computer may not work with an alias name

  2. Click Start, click Run, type regedit, and then click OK.
  3. In Registry Editor, locate and then click the following registry key:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa

  4. Right-click Lsa, point to New, and then click DWORD Value.
  5. Type DisableLoopbackCheck, and then press ENTER.
  6. Right-click DisableLoopbackCheck, and then click Modify.
  7. In the Value data box, type 1, and then click OK.
  8. Quit Registry Editor, and then restart your computer.

IIS And Hosting, Troubleshooting, Operating Systems