[Olsr-dev] olsr_malloc()s id parameter

Hannes Gredler (spam-protected)
Tue Sep 2 22:10:14 CEST 2008


On Tue, Sep 02, 2008 at 09:21:52PM +0200, Henning Rogge wrote:
| On Tue, Sep 2, 2008 at 19:37, Bernd Petrovitsch <(spam-protected)> wrote:
| > Another thing (while I'm at it):
| >
| > olsr_malloc() wants a parameter which is some hint to the place in case
| > it fails.
| > But since the error handling of "out of memory" errors is always
| > "exit()", I see no particular value to know the exact place where the
| > failed malloc() happened.
| > So we can as well remove that parameter.
| No...
| 
| > Or does anyone here see any value on that information?
| Yes...
| first it's a good way to find a memory "leak" (which allocation is
| called too often).
| Second it's good for getting statistics (which we are not doing at the moment).
| 
| In an OOM error it doesn't matter which malloc did it... but if you
| just output all mallocs with size and id you get an idea what caused
| the problem.
| 

agreed - for all block based (read: fixed size allocations) one should
use olsr_cookie_malloc(). there is a lightweight memory manager behind
which also keeps some stats to track memory churn and leaks.
while eliminate dthe empty_tc_timer i figured that the packet building
infrastructure can be rewritten to take advantage of that.

/hannes




More information about the Olsr-dev mailing list