Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

One tricky thing here is that this does break the normal memory management semantics. That is, while one nice thing about malloc/free is that you can drop pretty much any implementation of a user-space memory allocator in there without changing your code, this is no longer the case. Whatever replacement allocator you use will have to change its interface, and probably its data structure, to fit the new model.

Edit: Also, how is this better than doing something like this

  struct some_complex_struct {
  ...
  };

  free_some_complex_struct(struct some_complex_struct * scs) {
  ...
  }


I don't understand why talloc preclues a different malloc/free implementation.

According to the article, talloc is a malloc wrapper. If that's the case, why shouldn't you be able to drop in whatever allocator you want? talloc should still use it under the covers.


Ah, I didn't see it's a wrapper. In that case, what's the point of using it at all? If it doesn't help to optimize the memory allocation, it seems more like a macro and less like a library.


Author of the article says quite clearly why he thinks it is useful.


But he doesn't quite make it clear if he wants it done for every memory allocation, or that specific type of allocation. The two have very different results.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: