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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:00:30+00:00 2026-06-12T17:00:30+00:00

I’m looking forward to understanding how dynamic memory management works at low level in

  • 0

I’m looking forward to understanding how dynamic memory management works at low level in GNU/Linux systems (aka, how ptmalloc works).

Of course, I’ve read the code but I have a lot of doubts. I, more or less, understand the data structures but I have many information leaks!

My question is if someone knows about any resource explaining in detail the implementation. For example, I’ve read papers such as ‘Understanding the heap by breaking it’ or the ‘Malloc Malleficarum’ series and post-series. They do a great job, but, of course, they are more focused in exploitation than in explaining many implementation details.

If you don’t know about any resource, here are some of my questions.

  • What really is an arena? In the code for the variable ar_ptr from heap_info struct there is a comment saying ‘arena for this heap’, so an arena can not be a heap (as it is said everywhere).

  • Why in the heap_info struct there is not a next pointer and there is a prev pointer? Is it because of main_arena? And what is main_arena?

  • Every heap_info struct can have more than one arena (pointing to different malloc_state structures)?

  • When are created news arenas and what code handles it? I’ve read that new arenas are created when an arena requested for storing data is locked (because the process or a process thread is working with it) and I’ve also read that each process thread have a different arena. The important thing here is if you know what code handle these situations.

  • I also don’t understand when people says that all memory operations born from the top chunk or wilderest chunk. Do you know where can I found this code?

BTW, I don’t want to go deep with mutex details.

I’m reviewing ptmalloc implementation in glibc 2.12.1. I would like to make some diagrams about the overall structure of everything so I need to understand these things!

Thank you.

  • 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-06-12T17:00:31+00:00Added an answer on June 12, 2026 at 5:00 pm

    Ok, I’ve done some research and I have the answer for many of those questions.

    • The arena is the memory region in which all the dynamic data of a process will be stored. In short, the arena is the memory structure that in the past was called heap. Given that nowadays (with the multithreading stuff) you want to have more than one heap per process, you handle it by creating something called arena, but this arena is nothing more than a heap. The heap_info structure only manages the multiple existent arenas of a process.

    • I don’t know why there’s only a prev pointer. What I know is that normally, all the dynamic data is stored in the main_arena, it is the arena that is created for that process. I don’t know in which circumstances the main_arena is not used, what I know is that if the size field in a memory chunk has the NON_MAIN_ARENA bit set, then the main_arena is not used, and the algorithm gets the new arena address from clearing out the 20 less significant bits of that memory chunk pointer through the heap_for_ptr() macro. To sum up, in normal circumstances, the main_arena will always be used.

    • Yes, as I said, each heap_info struct can have multiple arenas. This is because of lock contention. If you have enough free time, you can read about this in [1].

    • I don’t remember this one. But the fact is that if the arena is in use, locked, a new arena is created. Search any call to a function similar to new_arena() or new_heap(). I remember that the function name was similar to that.

    • I think that this only mean that at the beginning all memory space for the heap is the top chunk (or wilderness chunk), so when new memory requests are demanded from the process, this top chunk is divided and fragmented. So it all starts with the top chunk.

    Without wanting to be pompous, I think that, after three months, my answer is the one that is more adjusted to my questions, so I’ll put it as the correct one. On the other hand, thanks for all the other answers. They have been really helpful.

    BTW, I’ve put all this research in a paper, but given that it is in spanish, I don’t think it will be of use here, and I don’t know if it would be considered spam. [2]

    [1] http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.16.4439

    [2] Here you have the paper: http://overflowedminds.net/papers/newlog/linux_heap_exploiting_revisited.pdf

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
Let's say I'm outputting a post title and in our database, it's Hello Y’all
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

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.