4 ms·
I understand that talloc adds complexity, but what large project with multiple collaborators does not already have some memory management policy? C forces you
by daxelrod 16y ago
I understand that talloc adds complexity, but what large project with multiple collaborators does not already have some memory management policy?
C forces you to explicitly communicate who is responsible for allocating and freeing each piece of memory. Isn't talloc just providing a mechanism that helps with this?
If talloc is part of a project's memory management policy, contributors not using it consistently are by definition not following the policy consistenly. This would be a problem regardless of mechanism.
- nviennot 16y agoHum.. the Linux Kernel, it's pretty big :) You get kmalloc() and kfree(), which are very similar to malloc() and free(). (Okey you also get kmem_cache_alloc()/kmem_cache_free() which gives you the ability to provide a ctor/dtor, but they are explicit) tmalloc() does too much: The day you have some memory corruption / leak, you'll start being scared of using tmalloc().