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 8997477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:53:41+00:00 2026-06-15T23:53:41+00:00

My issue is that I have a 32-bit DLL which I cannot modify. The

  • 0

My issue is that I have a 32-bit DLL which I cannot modify. The DLL can sometimes require around 1.5 gigs of memory or so under normal operation.

When I use a C++/unmanaged code test program, the DLL will only go out of memory at about 2 gigs. This is expected as this is the maximum size available to a 32-bit process. Hence, the DLL runs fine under normal operation.

When I P/Invoke the DLL from a C# application that itself takes about 250 MB, the DLL errors out when the entire process reaches about 1.4 gigs. My question is does P/Invoke provide less memory for the 32 bit process to use? Is there some way I can give it more?

EDIT: The P/Invoked functions are actually called from a C# assembly referenced by my main assumbly. Not sure if this is relevant in any way.

  • 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-15T23:53:42+00:00Added an answer on June 15, 2026 at 11:53 pm

    The difference is probably because your managed program has greater needs than the unmanaged program. And so there are fewer resources left for your DLL. Programs can run out of memory even when there appears to be memory left. This happens when the address space is fragmented and the virtual memory allocator cannot find a large enough contiguous block of memory to meet an allocation request.

    There’s not much you can do about that I suspect. I doubt you’ll have much luck trying to make your managed process consume fewer resources. If you run on a 64 bit system and your process is large address aware then your process can access have 4GB of memory.

    Marking your .net executable as LARGEADDRESSAWARE might well help. For details please refer to another SO question: How to make a .NET application "large address aware"? In summary you need to run the EDITBIN tool to mark your executable:

    EDITBIN /LARGEADDRESSAWARE YourExeName.exe
    

    Be aware though that on a 32 bit OS you are pretty much stuck with the 2GB limit. Yes you can boot your system with the /3GB switch but this is generally not to be advised.

    The other obvious option would be to house the DLL in an out of process COM server. By putting it in a different process you could keep the .net runtime out of the process and leave as much space as possible for the hungry DLL.

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

Sidebar

Related Questions

Having an issue here that I have tried everything I can think of but
I have an issue that is driving me nuts and hoping someone can help.
How can I have code-sharing between two projects without making a dll? The issue
I have a 32 bit .Net application winform that invokes a C++ dll. We
I am having a problem with a 32-bit ATL dll that I have created---whenever
I have a pretty common layout issue that I have traditionally used a table
My issue is that I have two (or more) divs of the same class,
I have issue that is reproduced on g++. VC++ doesn't meet any problems. So
My issue is that I have created a table for a local db in
I'm running into an issue in that I have a document indexed with elasticsearch

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.