Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 236109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:19:07+00:00 2026-05-11T20:19:07+00:00

I got an OutOfMemoryException earlier and couldn’t figure out what it was for. It

  • 0

I got an OutOfMemoryException earlier and couldn’t figure out what it was for. It made no sense at all. Dug around in my code, and suddenly remembered that somewhere had forgotten to check for null, and in this particular case it was (and should be) exactly that. That shouldn’t cause an OutOfMemoryException in my opinion, but I fixed it anywas of course. And when I did, the exception didn’t appear anymore!

So I removed the check again and studied the exception I got some more. And turns out it had an InnerException of type NullReferenceException and a stack trace which of course made a lot more sense.

But why did I get an OutOfMemoryException? This has never happend to me before… makes no sense to me…


Would love to give some more context, but can’t really say much without having to upload the whole project, which I can’t (And which you wouldn’t want to read through anyways :p). But the specific place it happend looks like this:

            {
                foreach (var exportParameter in exportParameters)
                {
                    // Copy to local
                    var ep = exportParameter;

                    // Load stored values from db
                    ...
                }

                int i = 1;
                exportParameters
                    .OrderBy(ø => ø.Sequence)
                    .ForEach(ø => { if (!ø.Locked) ø.Sequence = i++; });
            }

The fix was to put an if(exportParameters != null) before the code block. exportParameters is a List<ExportParameter>, except in the failing case in which it was null.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T20:19:08+00:00Added an answer on May 11, 2026 at 8:19 pm

    You might be facing the problem that Constrained Execution Regions are designed to prevent – that is, the JITting of some code that your catch clause relies on is causing the out of memory condition.

    (In response to svish’s comment, this is the first link when googling the phrase: http://msdn.microsoft.com/en-us/library/ms228973.aspx)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Got a class that serializes into xml with XMLEncoder nicely with all the variables
Got a bluescreen in windows while cloning a mercurial repository. After reboot, I now
got a new blog at wordpress few days ago ( http://ghads.wordpress.com ) and I
Got myself in a bit of a pickle here ... working on a CMS
Got a problem with ADOMD.NET 8.0, SQL2008 and our app. It isn't giving us
Got a bit of a mind freeze at the moment. I have the following
I got into a mini-argument with my boss recently regarding project failure. After three
I got a webserver with a running application. There's a webpage with a form:
I got this error today when trying to open a Visual Studio 2008 project
I got this output when running sudo cpan Scalar::Util::Numeric jmm@freekbox:~/bfwsandbox/sa/angel/astroportal/dtu8e/resources$ sudo cpan Scalar::Util::Numeric [sudo]

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.