freeipmi-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Freeipmi-devel] [bug #14993] libfreeipmi sensor event messages mem-


From: Albert Chu
Subject: Re: [Freeipmi-devel] [bug #14993] libfreeipmi sensor event messages mem-leaks (ipmi-sensor-event-messages.c)
Date: Tue, 13 Dec 2005 15:15:12 -0800

Hey AB,

> We lost track of this bug. Can you please provide more info.

Here's the e-mail from a few months back:

-----
,----[ Albert Chu <address@hidden> ]
| 1) I have grave concerns with the strdup() of all of the event
| messages.  I apologize if I'm missing something, but I can't find
| where these strings are or will be freed.
|                                                                       
| When binary tools mem-leak all over the place and quickly exit, I
| feel its fine.  However, IMHO, libraries should never mem-leak,
| because you don't know how users will use the library.  For example,
| we have a host monitoring tool that loops forever doing sensor
| readings.  The current library would mem-leaks and eventually cause
| our host monitoring daemon to crash.
`----
Memory leaks are serious problems. For libraries and daemons, it is
critical. Even for binaries like "fish" are interpreters. Remember if
perl or bash has memory leaks!!. Let us take this as an important
issue before 0.2 release. 

,----[ Albert Chu <address@hidden> ]
| I see several solutions:
|
| 1) Return pointers to statically defined string locations.
|
| 2) Create buffers in the various structures and copy strings into
|       the buffers.
| 3) create a "destroy" or "cleanup" function.
|                                                                       
|                       
| I think option #1 is the best, but that's just me.
`----
There are some more ways.
4) alloca
   It is easier to make alloca portable than avoiding leaks.
   Alloca is also faster than malloc family of functions.
   Freeing is automatic. For string copying, we have strdupa, strndupa
   based on alloca. I personally preferred alloca.

I like the Al's first option (static buffers) too. It is fast and
requires no freeing. Even if we make most of allocations static, total
memory consumed will still be very very small.
-----

Al

--
Albert Chu
address@hidden
Computer Scientist
High Performance Systems Division
Lawrence Livermore National Laboratory


----- Original Message -----
From: Anand Babu <address@hidden>
Date: Tuesday, December 13, 2005 3:08 pm
Subject: Re: [Freeipmi-devel] [bug #14993] libfreeipmi sensor event
messages mem-leaks (ipmi-sensor-event-messages.c)

> ,----[ Albert Chu <address@hidden> ]
> |                  Summary: sensor event messages mem-leak => 
> libfreeipmi| sensor event messages mem-leaks (ipmi-sensor-event-
> messages.c)`----
> Hi Al,
> We lost track of this bug. Can you please provide more info.
> -- 
> Anand Babu 
> GPG Key ID: 0x62E15A31
> Blog [http://ab.freeshell.org]              
> The GNU Operating System [http://www.gnu.org]  
> 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]