tdb_fetch(TDB_CONTEXT, TALLOC_CTX, const char *) ?
tridge at osdl.org
Sat Jun 4 23:34:18 GMT 2005
> Can you cachegrind it to see the effect on speed ?
There is a chance it will increase speed, at least for ldb. At the
moment ldb_tdb uses talloc_memdup() to copy the data it gets from
tdb. It would be much nicer (and faster) to use talloc_steal().
I've wanted to convert tdb over to a talloc interface for a while. I
just haven't had time.
Volker, it would be much less of a code change to not actually specify
the talloc context, and instead to allocate in the TDB_CONTEXT (as I
presume that will be a talloc context as well). The caller could then
talloc_steal() to put the memory wherever they like.
You could then add a tdb_data_free() call, which calls talloc_free(),
and a tdb_fetch_talloc() call which does take a talloc context.
This would mean a much smaller number of code changes. The change
outside of tdb would be to find all places where TDB_DATA records are
deallocated with free(), and either change them to use tdb_data_free()
or change the tdb_fetch() call to tdb_fetch_talloc(), whichever is
More information about the samba-technical