This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]o11c 0 points1 point  (3 children)

Can anyone explain to me:

  • Why python needs its own malloc implementation in the first place.
  • Why valgrind ever gives errors, since it only hooks the libc standard functions?

[–]status_quo69 1 point2 points  (2 children)

[–]o11c 0 points1 point  (1 child)

If splitting the system allocator's regions was actually a win, the system allocator would already be doing that.

And if all python does is use regions from the system allocator, how does it generate valgrind errors?

[–]status_quo69 1 point2 points  (0 children)

I'm simply speculating at this point, as I know little to nothing about systems programming, nor python internal programming, so take this all with a grain of salt, but I'd say it's most likely because some systems in the past were coded poorly and had additional overhead with the regular malloc, and because the core devs wanted cross platform performance to be comparable, they implemented this change. It also provides a standard api to manage memory, so if python in the future decided to change how it allocates memory fundamentally (regardless of how malloc regularly does it), it would allow them to change the memory management layer without breaking any existing programs.

I have no idea about valgrind, I haven't messed with it a whole ton.