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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:33:10+00:00 2026-05-19T01:33:10+00:00

The question is in the title… I searched but couldn’t find anything. Edit: I

  • 0

The question is in the title… I searched but couldn’t find anything.


Edit:

I don’t really see any need to explain this, but because people think that what I’m saying makes no sense (and that I’m asking the wrong questions), here’s the problem:

Since people seem to be very interested in the “root” cause of all the problem rather than the actual question asked (since that apparently helps things get solved better, let’s see if it does), here’s the problem:

I’m trying to make a D runtime library based on NTDLL.dll, so that I can use that library for subsystems other than the Win32 subsystem. So that forces me to only link with NTDLL.dll.

Yes, I’m aware that the functions are “undocumented” and could change at any time (even though I’d bet a hundred dollars that wcstombs will still do the same exact thing 20 years from now, if it still exists). Yes, I know people (especially Microsoft) don’t like developers linking to that library, and that I’ll probably get criticized for the right here. And yes, those two points above mean that programs like chkdsk and defragmenters that run before the Win32 subsystem aren’t even supposed to be created in the first place, because it’s literally impossible to link with anything like kernel32.dll or msvcrt.dll and still have NT-native executables, so we developers should just pretend that those stages are meant to be forever out of our reaches.

But no, I doubt that anyone here would like me to paste a few thousand lines of code and help me look through them and try to figure out why memory allocations that aren’t failing are being rejected by the source code I’m modifying. So that’s why I asked about a different problem than the “root” cause, even though that’s supposedly known to be the best practice by the community.

If things still don’t make sense, feel free to post comments below! 🙂


Edit 2:

After around ~8 hours of debugging, I finally found the problem:

It turns out that RtlReAllocateHeap() does not automatically work like RtlAllocateHeap() if the pointer given to it is NULL.

  • 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-19T01:33:10+00:00Added an answer on May 19, 2026 at 1:33 am

    It has to point to the beginning of the block. It’s safe to pass a null pointer to free(), but passing any pointer not allocated by malloc() or one of its relatives will cause undefined behaviour. Some systems will give you a runtime error – something along the lines of “Deallocation of a pointer not malloced”.

    Edit:

    I wrote a test program to get the error message. On my machine, this program:

    #include <stdlib.h>
    
    int main(int argc, char **argv)
    {
      int *x = malloc(12);
      x++;
    
      free(x);
    
      return 0;
    }
    

    Crashes with this message:

    app(31550) malloc: *** error for object 0x100100084: pointer being freed was not allocated
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The question title is kind of vague, but I really don't know what the
Sorry about the weird question title, but I don't really know what to call
I realize this question title is pretty overused, but I couldn't find an answer
Sorry about the question title, but I couldn't find a more appropriate way to
Couldn't think of a more appropriate question title, but I'm looking for some advice
Please excuse the vague question title, but usually I don't do such kind of
Just what the question title says. I'm using SpringMVC, but that's irrelevant really. I
I m really sorry for unclear question title but I am a bit confused
First: apologies for the question title, I don't actually know what the problem is
the question title seems pretty confusing, but this is what i want to achieve.

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.