3 ms·
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 prett
by Locke1689 16y ago
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) {
...
}
- daxelrod 16y agoI 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.
- Locke1689 16y agoAh, 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.