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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T05:02:51+00:00 2026-05-19T05:02:51+00:00

In 32bit mode application has access to 2GB of virtual address space. How would

  • 0

In 32bit mode application has access to 2GB of virtual address space. How would you find out the maximum size of memory you can allocate to this virtual address space, without malloc or new failing?

For example, lets say you want to take up the whole 2GB of virtual address space, but you just allocated 2MB of data in the middle of the 2GB address space. Is there a Windows API call that you can find out the max concurrent address space that you can allocate? So that when you call malloc or new the call does not fail?

Thank you for your time.

  • 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-19T05:02:51+00:00Added an answer on May 19, 2026 at 5:02 am

    Source:
    http://www.voyce.com/index.php/2009/08/21/largest-free-block-of-address-space/

    DWORD FindLargestSizeOfMemory()
    {
    
        MEMORY_BASIC_INFORMATION mbi;
        DWORD start = 0;
        bool recording = false;
        DWORD freestart = 0, largestFreestart = 0;
        __int64 free = 0, largestFree = 0;
    
        while (true)
        {
            SIZE_T s = VirtualQuery((LPCVOID)start, &mbi, sizeof(mbi));
            if (s != sizeof(mbi)) break;
    
        if (mbi.State == MEM_FREE)
            {
                if (!recording) freestart = start;
    
                free += mbi.RegionSize;
                recording = true;
            }
            else
            {
                if (recording)
                {
                    if (free > largestFree)
                    {
                        largestFree = free;
                        largestFreestart = freestart;
                    }
                }
                free = 0;
                recording = false;
            }
            start += mbi.RegionSize;
        }
    
      return largestFree;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been running Apache HTTPD in 64bit mode by stripping out the 32bit
If a 32bit Operating System operated with a segmented memory model would their still
Suppose I ask the user do you want to run in 32bit mode or
OS: Windows 7 32bit So in like c++ one has a heap and a
I'm working on a c# service application and i have this problem where out
My company has a VB6 application using Crystal Reports 7 which a client has
I have a C# application that must run in x64 mode. The problem is
Having some out-of-memory problems with a 32-bit process in Windows I begun using Performance
Using Visual Studio, I have built an C++ application running in 32bit. It will
In xp 32bit this line compiles with not problem however in vista 64bit this

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.