Home

out of memory error with linqpad

the data that i am rendering is definitely large. however, how to i troubleshoot this OOM as i need to know the breaking point.
it starts out like this.
1.
2. and it becomes like this.
When i look at the task bar, the meoory hardly crosses 50% and i have 32 gig of ram.
https://i.imgur.com/gvsL4lu.png

Comments

  • Is it possible for you to try LinqPad 8?

    I've come across the 1.4 GB threshold many times before (not just with LinqPad) and it has always indicated a 32-bit process.

    My taskmanager screenshot showing LinqPad 8 (on Windows 10) makes it obvious that the subqueries are also 64-bit processes.

  • my taskbar is showing x64
    what is the way to double check if its crossing 1.4 gb threshold?

  • The second line on your screenshot shows one of your queries (and I'm assuming it is the one that ran out of memory) which just says LINQPad7.Query and doesn't says whether it is 32 or 64-bit process but the memory for it is 1,460.1MB which is approx 1.4GB . Of course the description isn't proof, but it would be a strange coincidence for a 64-bit process to run out of memory just at this figure.

    My screenshot of LinqPad 8 shows differently and the queries are shown as sub-processes with the same name, and again the description isn't proof, but you can see that one of the queries is using 2.441.5MB which means it is definitely a 64-bit process.

  • all valid inferences. the big question is on how to see if the subprocess on linqpad 7 is 32 bit and will get stuck. i dont want to pay 75$ upgrade fee unless its absolutely necessary.
    Hopefully @JoeAlbahari will guide here

  • edited October 10

    Please run System.Environment.Is64BitProcess.Dump() to check bitness.

    LINQPad 7 window header contains x86 for 32-bit processes as well as its splash screen.

    You can use Process Explorer to find out bitness of the process (right click on header and configure column):

  • Maybe the object graph that you're dumping has excessive detail. This all has to be converted to HTML and then rendered, and while the Chromium rendering engine is fast and efficient, it has limits.

    You could try calling Dump with a number to limit the depth, e.g., .Dump(1) or .Dump(2) to see whether it makes any difference.

  • If you have a memory profiler (like https://www.jetbrains.com/dotmemory) you can attach to the running process. Just add something like the following to the start of your script.

    Util.ReadLine($"Attach to ProcessID {System.Environment.ProcessId} and then press return");
    

    I was going to say that it may not be as simple as this as it could be the separate webview2 process that runs out of memory, but I don't see one in your taskmanager screenshot.

    It does on mine. I wrote a tiny script that looped allocating and dumping more and more stuff

    The memory usage of LinqPad increases past this, but webview2 doesn't go much higher than this as LinqPad stops dumping stuff and just displays "", so I don't get an out of memory error

  • edited October 11

    ok. I split the object and dumped it. i can print it in the output window and its pretty quick.
    i would have loved to see it in 2 output windows as i need to find where the second half is by scrolling.
    Is there a option to customize it in the Util.Horizontalrun?
    // Calculate the midpoint of the collection
    int midpoint = analysiscollection2_expando.Count() / 2;

    // Split the collection into two halves
    var firstHalf = analysiscollection2_expando.Take(midpoint);
    var secondHalf = analysiscollection2_expando.Skip(midpoint);
    
    // Run HorizontalRun on the first half (this will show it in the first output window)
    

    Util.HorizontalRun(true, firstHalf).Dump("First Half", exclude: "", depth: 2);

    // Run HorizontalRun on the second half (this will show it in the second output window)
    Util.HorizontalRun(true, secondHalf).Dump("Second Half", exclude: "", depth: 2);
    
Sign In or Register to comment.