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

To my friends who don’t understand why I don’t like talking on the phone.. I’m not the only one.

24. March 2011

Read this great article over at TechDirt by Mike Masnick.  “Phone Calls Are So Last Century”.

Was right up my ally.  I don’t like to talk on the phone.  It interrupts me and my train of thought when I’m working.

A snippet from the article that applies.

… And it was at that point that I realized how rare it is that I'll accept or make unexpected or unplanned phone calls, with the exception of my wife and my parents (and potentially some work-related "emergency.") There are a few very close, long-term friends that I'll call every so often, but I really haven't done that in a while, and I feel a bit awkward about doing it these days. I still talk on the phone for meetings, but always at set times.

Apparently, I'm not the only person who feels this way.

Also NY Times has an article on it as well.

So when I don’t answer your call, it’s not personal. Txt me if you want to get anywhere.

About Me, Personal

Application I developed recognized in Top 20 Awards.

17. March 2011

The application that I develop on has been has been recognized as “Top 20 Best in KLAS Awards” by KLAS Research

Personal, Programming, Software

Adobe Encore CS5 cannot run in non-royalty serialized mode. The Application needs to be serialized with a royalty bearing serial number. Or Indesign does not have proper serial.

15. March 2011

 

If you happen to get this issue with your CS5, I’ve found a solution.

Basically what happen is that Adobe Encore accepts only special serial numbers and it wont accept our Master Serial all the time. If this happens you need to use this simple fix:

  • Just copy and paste the “amtlib.dll” to your C:/Program Files/Adobe/Adobe Encore CS5 folder. When asked select “Copy and Replace” and it will work properly.
    Do this only for Encore and DO NOT replace other original amtlib.dll’s
  • If this do not work try to reactivate Encore CS5 with Encore serial that I provided below (1132-1127-8739-4724-1356-4304) You can do from Encore Help panel in the main Encore menu after you open Encore
  • If this doesn’t work perhaps you need to change the main Adobe CS5 Master Collection serial number by deactivating the whole CS5 suite and activating again with different serial.
  • You need to still remember to follow all the safety procedures when doing it so (being disconnected from the internet, fixing your host file and blocking Encore with firewall)

 

Download File: amtlib.dll
You can use this for Encore or Indesign CS5 Master Collection

Troubleshooting, Software

Upgrading your IIS 1024 SSL Cert to 2048 Encryption

14. March 2011

 

If you’re trying to renew your cert to 2048 on IIS from 1024, it’s not as straight forward.  The cert request you produce on IIS will fail validation at your SSL provider if it’s not a request to renew a 1024 cert.

MS has a solution, but it’s basically.. you create another dummy site. Create a new certificate there and then instead of renewing your other site, you tell it to replace the existing cert with the new one.

 

Here are the actual steps.

http://support.microsoft.com/kb/295281

  1. In the Microsoft Management Console (MMC), right-click the default Web site, click New, and then click Site.
  2. Create a new site and give it a temporary name.
  3. Right-click the new site, click Properties, click the Directory Security tab, and then click Server certificate.
  4. Select Create new certificate and follow the wizard to create a new CSR. When prompted, select Prepare the request now but send it later.
  5. Use the CSR that you just created to request a new certificate from the certificate authority (CA) that issued the original certificate.
  6. When you receive the certificate from VeriSign or another third-party CA, save it to your hard drive. Remember the serial number of this certificate and where you save it.
  7. Right-click the temporary site that you created in step 2, click Properties, click the Directory Security tab, click Server certificate, and then click Next. Follow the wizard. When prompted, select Process the pending request.
  8. After the certificate has been installed, click OK, and then stop and start the Web site.
  9. Right-click the temporary site that you created in step 2, click Properties, click Directory Security, and then click Server certificate.
  10. Select Remove the current certificate and follow the wizard. This removes the certificate from IIS, but the certificate remains in the certificate store.
  11. Right-click the Web site that has the original server certificate installed (that is, the certificate that you are renewing or replacing), click Properties, click Directory Security, click Server certificate, and then select Replace the current certificate.
  12. Select the certificate that you just installed. If you see duplicate certificate names, make sure that you select the certificate that matches the serial number that you noted in step 6.

IIS And Hosting

Leave VB.NET for C#?

3. March 2011

I’ve been posting all my code in VB.NET and if you haven't figured out by now; it’s my choice of language.  

Recently I’ve been debating on moving to C# but am reluctant.  Then I ran across this article my friend sent me.

Should I abandon VB.Net?

http://blogs.lessthandot.com/index.php/ITProfessionals/ProfessionalDevelopment/should-i-abandon-vb-net by chrissie1

He states it all perfectly. How VB.NET Developers feel. 

Should I abandon VB.Net? This is a question that crosses my mind from time to time, but lately it is getting stronger. At least it would make my life simpler. Copy paste coding gets even better when you are a C# programmer since there are so much more examples out there. The community is bigger and better for C#. Even Microsoft discourages the use of VB.Net. If you ever go to something like techdays you will find that VB.Net is nowhere to be found. In that community you will be mocked and ridiculed if you tell them you are a VB.Net programmer. You are looked down upon, even by the spaghetti programmers. But then the .Net community seems to be rude and unfriendly whatever you do. I noticed that when I did my little powershell series over the weekend.

So the question crosses my mind if I was wrong to choose VB.Net ….

Granted he’s a WinForms developer rather then a Web .NET Web Forms or MVC developer but it still applies.

Do I think I should change because of all of the reasons above? Nope, not any time soon.

and he ends it with a great statement:

Don't change things for the sake of change, change things for the better. Let's not forget that even the best and brightest get it wrong.

Read the full article: http://blogs.lessthandot.com/index.php/ITProfessionals/ProfessionalDevelopment/should-i-abandon-vb-net

C#, VB.NET, .Net Framework

Outlook 2010 – Switch between “Showing Unread and/or Flagged Items” and “Showing All Items”

25. February 2011

I like to limit my emails to messages I’ve not read and the ones I have flagged.  Sometimes though I want to see all the email.  There’s a quick and easy way to alternate between views.

Below I’ll show you screen shots of how you can do it.

But basically, you’ll create two views. One filters and one does not. Then you’ll just switch between them.

  1. Click on “View” Ribbon Tab
  2. Click on “Change Views”
  3. Click on “Manage Views”

 

image

Assuming your current Inbox view is what you want when you “Show All”.

  1. Highlight “Current View Settings”
  2. Click Copy
  3. Change the name to “All”
  4. Click Ok

 

image

Repeat again but this time name it “Unread or Flagged”

image

 

You should now have two new views in the list. 

  • All
  • Unread or Flagged

image

 

  1. Click on UnRead Or Flagged.
  2. Click on Modify
  3. Click Filter
  4. Click on the SQL Tab
  5. Click on the Checkbox “Edit these critera directly…”
  6. Type this into the filter box:

    ("urn:schemas:httpmail:read" = 0) OR ("http://schemas.microsoft.com/mapi/proptag/0x10900003" > 1)

  7. Click Ok, Click Ok, Click Ok

 

image

 

That’s all for the setup.

Now to switch between views, just click on “Views” and “Current View" and change between them.  If you are on Unread and switch to all, Outlook will keep the email you were looking at highlighted.

 

image

Tip of the Day, Software