[BusyBox] memory problem in syslogd
Matt Kraai
kraai at alumni.carnegiemellon.edu
Thu Jul 19 09:02:04 UTC 2001
On Wed, Jul 18, 2001 at 11:50:56PM -0400, Adam Slattery wrote:
> On Thu, 19 Jul 2001, Zhang Qilin wrote:
> > I found the reason of the memory problem for syslogd, it's the definition
> > of "BB_FEATURE_BUFFERS_GO_ON_STACK" and "BB_FEATURE_BUFFERS_GO_IN_BSS",
> > by default, both of them not defined, then "RESERVE_BB_BUFFER" will
> > use "xmalloc" to allocate memory, but didn't find the "free" operation.
> >
> > Maybe other applets have the same problem, but it's difficult to find
> > it if the applet is not a daemon.
>
> This is very true. If a call to the macro RESERVE_BB_BUFFER() is run
> multiple times it is definately a memory leak, and it looks like this is
> the problem in syslog.
>
> > Please confirm, thanks again.
>
> Yeah, it looks like that's the problem.
>
> This brings up an interesting point though. There is a
> RESERVE_BB_BUFFER(), but no RELEASE_BB_BUFFER().
I went ahead and added RELEASE_BB_BUFFER, and added a call in
syslogd. Someone feeling ambitious should probably audit the code
and replace all the fixed-size buffers with calls to
{RESERVE,RELEASE}_BB_BUFFER. Any takers?
Matt
More information about the busybox
mailing list