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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:20:34+00:00 2026-05-26T20:20:34+00:00

after going through glibc code for malloc() and the actual allocator i.e _int_malloc() function

  • 0

after going through glibc code for malloc() and the actual allocator
i.e _int_malloc() function I am not able to figure out the significance of “perturn_byte”. Its being used in alloc_perturb macro() at many places in _int_malloc().

i know this this question is just to specific to answer, please pardon me. But in case anybody already knows the anwser will save me some head banging.

thanks

  • 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-26T20:20:35+00:00Added an answer on May 26, 2026 at 8:20 pm

    Here is the commit, which adds perturb_byte:

    http://repo.or.cz/w/glibc.git/commitdiff/854278dff83a754f1d24a17c1c1068e8ebfe6195

    And here is the key comment (and example of turning this feature on):

    +  /* Make uses of freed and uninitialized memory known.  */
    +  mallopt (M_PERTURB, 42);
    

    So, it is debugging feature to detect misusage of free-d or malloce but not-yet-initialized memory.

    Every memory byte which malloc gets from system (via brk or mmap) will be filled with perturb_byte (which is not a zero). I think, free-ed memory will be filled too.

    Then user can check, is there still some uninialized in the malloced range or is there some write to free-ed memory.

    Here is the documentation: http://www.gnu.org/s/hello/manual/libc/Malloc-Tunable-Parameters.html

    M_PERTURB
    

    If non-zero, memory blocks are filled with values depending on some low order bits of this parameter when they are allocated (except when allocated by calloc) and freed. This can be used to debug the use of uninitialized or freed heap memory.

    As I see, this can be used only to do manual checks from debugger.

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

Sidebar

Related Questions

After going through few articles about performance, Not able to get this statement exactly.
After going through all of these steps to check out the Android source code
After going through Marshall code snippet Got the Idea that marshalling is used to
After going through MSDN Shell Extensions I am not quite sure if I can
After going through the Appendix A, C# Coding Style Conventions of the great book
Something is puzzling me, after going through my app with instruments, it is a
After searching online and going through past stackoverflow posts for a suitable implementation for
What I am going after is to be able to do something like this
Is there any way to debug what is going on after my .NET code
I am new to android and after going through many tutorials I still can't

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.