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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T21:40:02+00:00 2026-05-21T21:40:02+00:00

virtualpointer=(char*) VirtualAlloc (NULL, (unsigned __int64) (1<<31), MEM_RESERVE, PAGE_READWRITE); mainhashbuf=progression=virtualpointer; VirtualAlloc (progression, (unsigned __int64) (1<<15),

  • 0
virtualpointer=(char*) VirtualAlloc (NULL, (unsigned __int64) (1<<31), MEM_RESERVE, PAGE_READWRITE); 
mainhashbuf=progression=virtualpointer;
VirtualAlloc (progression, (unsigned __int64) (1<<15), MEM_COMMIT, PAGE_READWRITE);
progression=progression+capacity;
*(mainhashbuf+1000)='c';

mainhashbuf, progression and virtualpointer are pointers to char. I first reserve space, with virtual pointer pointing to that space. Then i set the other 2 pointers equal to virtual pointer. I then commit (1<<15) of that space using progression (which by now is also pointing to the reserve space), and then increment the progression pointer. Then I try to set a value in that now committed space which mainhashbuf SHOULD be pointing to, however i get a writing exception. Am I using virtualalloc wrong and/or have a wrong conception of how pointers actually work?

  • 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-21T21:40:03+00:00Added an answer on May 21, 2026 at 9:40 pm

    VirtualAlloc attempts to allocate a contiguous range of virtual pages. 1<<31 == 0x80000000, which is the amount of memory user-mode processes have on windows by default. I severely doubt that the call to the first VirtualAlloc is succeeding.

    Choose lower values and start again. Also, why are you using VirtualAlloc? When you’re new to pointers and direct memory management the concepts of committing and reserving in page-sized units can be a little daunting. Try working with malloc/HeapAlloc first? Also, check return values from VirtualAlloc and ensure they’re non-NULL.

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

Sidebar

Related Questions

Having at least one virtual method in a C++ class (or any of its
I have a virtual class that has been derived from a non virtual class.
What is the size of virtual pointer(VPTR) for a virtual table in C++? Also
I have some questions about the object size with virtual. 1) virtual function class
Does anyone know when calling 'seek' and 'read' , how is the hard-drive physicly
I'm writing a macro to let me replace the spaces in a string in

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.