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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:14:56+00:00 2026-05-26T23:14:56+00:00

Is malloc deterministic? Say If I have a forked process, that is, a replica

  • 0

Is malloc deterministic? Say If I have a forked process, that is, a replica of another process, and at some point both of them call the malloc function. Would the address allocated be the same in both processes? Assuming that other parts of execution are also deterministic.

Note: Here, I’m only talking about virtual memory, not physical one.

  • 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-26T23:14:57+00:00Added an answer on May 26, 2026 at 11:14 pm

    There is no reason at all for it to be deterministic, in fact there can be some benefit to it not being deterministic, for example increasing the complexity of exploiting bugs (see also this paper).

    This randomness can be helpful at making exploits harder to write. To successfully exploit a buffer overflow you typically need to do two things:

    1. Deliver a payload into a predictable/known memory location
    2. Cause execution to jump to that location

    If the memory location is unpredictable making that jump can become quite a lot harder.

    The relevant quote from the standard §7.20.3.3/2:

    The malloc function allocates space for an object whose size is
    specified by size and whose value is indeterminate

    If it were the intention to make it deterministic then that would be clearly stated as such.

    Even if it looks deterministic today I wouldn’t bet on it remaining so with a newer kernel or a newer libc/GCC version.

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

Sidebar

Related Questions

I need help with malloc() inside another function . I'm passing a pointer and
What I want is to have the forked process, which is copy of its
following this previous question Malloc Memory Corruption in C , now i have another
i have a structure malloc()'d, and after using them, i want to free() it,
I want to malloc some memory, run some operations on that memory, and then
The malloc function uses both sbrk and mmap functions. Now the sbrk function increases
Is the malloc() function re-entrant?
Let's say I: malloc a pthread_t for holding a thread context pthread_create with as
I've never used malloc to store more than values but I have to use
We know that malloc() and new operation allocate memory from heap dynamically, but where

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.