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

  • SEARCH
  • Home
  • 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 8641147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:27:07+00:00 2026-06-12T11:27:07+00:00

I am working on a .NET application for processing geographic data that uses ESRI’s

  • 0

I am working on a .NET application for processing geographic data that uses ESRI’s ArcObjects COM library via ESRI’s own .NET interop assemblies.

When running in production, the process can crash during some operations due to reaching the 2GB per-process memory limit. (ArcObjects is a 32-bit library.) This is because some of the processing steps can create many temporary ArcObjects geometry objects. It will leak memory and eventually run out of memory despite manually releasing these objects using FinalReleaseComObject and associated helper methods. However, I can force the GC to release the memory by calling WaitForPendingFinalizers, and calling it regularly along with GC.Collect and FinalReleaseComObject keeps the memory usage under control. Otherwise, many objects remain in memory until the process exits (normally or abnormally).

First question: why isn’t the memory held by the ArcObjects COM objects released immediately? Or, why does the GC allow the process to crash instead of finalizing the released COM objects and reclaiming the memory before it crashes?

The application runs in production on Windows 2008 64-bit, while I develop using Windows 7 32-bit. I can get the process to crash on the production boxes, but not on my development box. I thought that this may have been because locally I usually run in Visual Studio with a Debug build, but I have also tried it without the debugger (Start Without Debugging) using a Release build but even then it didn’t use anywhere near as much memory as in production and won’t crash.

Second question: Why?

EDIT: In my previous experiments, I worked out that GC.Collect by itself is not sufficient, even though I was calling it explicitly. I have a utility method that calls GC.Collect followed by GC.WaitForPendingFinalizers and calling it after every algorithm iteration keeps memory usage down.

  • 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-06-12T11:27:08+00:00Added an answer on June 12, 2026 at 11:27 am

    COM objects used in managed applications are sitting behind a runtime-callable wrapper (RCW) which is a managed object that replicates the interface of the COM object towards the managed client (it’s a bridge between the managed and unmanaged components). If I remember correctly, the actual COM interface references are held by the RCW, not by your code. When you release the COM object, it’s really the RCW that’s released but that, being a managed object itself, doesn’t go away until the GC gets around to clean it up. When that happens, the RCW is deleted and the last reference to the COM object is gone, so it can destroy itself. (According to the documentation, FinalReleaseComObject should set the refernce count to 0 but I’ve seen similar behavior in the past so I question whether the documentation is correct.)

    As for your second question, I have a guess: I’ve seen in stressed environments that the GC simply doesn’t get a chance to run when the system is under heavy load. Back then we determined that the GC ran on a lower-priority thread and our application was using so much CPU that the GC never had a chance to clean up. We had to add another thread that was periodically calling GC.Collect() every once in a while – this forced the GC thread to awaken and do its magic. You may be facing something similar. (This may be the reason behind the your issue in #1, too.)

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

Sidebar

Related Questions

I'm trying to extend the functionality of an ASP.net application that I'm working with.
I am currently working on a new application (.Net 3.5/Win2008 Server environment) that does
I am working on a 64-bit .Net Windows Service application that essentially loads up
I have an ASP.NET application that uses Session.SessionID to prevent multiple users viewing the
I am working on a .NET application that displays multiple charts. My users would
I'm working on a .Net application which uses Asp.net 3.5 and Lucene.Net I am
I am working on asp.net application and I have generated entity model (edmx) from
I am working on a .NET application where there appears to be a memory
I am working on asp.net application and I have an update panel like this:
I am working on a .NET application to reduce image file sizes using ImageMagick

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.