[Date Prev][Date Next] [Chronological] [Thread] [Top]

RE: need to read an entry from the db after reading config file

> -----Original Message-----
> From: Jason Townsend [mailto:jtownsend@apple.com]

> > Look at back-bdb/tools.c; slapcat creates a pseudo-op in back-hdb
> > mode. There
> > are a couple of different "ctx" fields in the operation, it's not
> > clear what
> > you're talking about. Of course, it's a moot point - the threadctx
> > will be
> > retrieved if it's needed and not provided, and the
> tmpmemctx is purely
> > optional. If you don't provide a tmpmemctx then mallocs
> will all use
> > regular
> > malloc instead of temporary memory.
> Don't all the backends assume that anything they malloc using the
> tmpmemctx will be cleaned up automatically?

No. Temporary mallocs must be explicitly freed, just like regular mallocs. If
your assumption was the case, then there would be no need for an sl_free()
function at all, and you would never have needed to file ITS#3092.

Note that the temporary memory space is only 1MB by default; when it gets
full the tempmem functions fall back onto regular malloc. (Having seen it
fill up once or twice, I've considered raising the default size to 2MB...)

  -- Howard Chu
  Chief Architect, Symas Corp.       Director, Highland Sun
  http://www.symas.com               http://highlandsun.com/hyc
  Symas: Premier OpenSource Development and Support