ITS#8725 add slap_sl_mark / slap_sl_release

For fast cleanup after constructing disposable entries
This commit is contained in:
Howard Chu 2017-03-14 08:50:17 +00:00
parent 68e064ca84
commit db3909d27d
2 changed files with 23 additions and 0 deletions

View file

@ -1858,6 +1858,11 @@ LDAP_SLAPD_F (void *) slap_sl_calloc LDAP_P((
ber_len_t nelem, ber_len_t size, void *ctx ));
LDAP_SLAPD_F (void) slap_sl_free LDAP_P((
void *, void *ctx ));
LDAP_SLAPD_F (void) slap_sl_release LDAP_P((
void *, void *ctx ));
LDAP_SLAPD_F (void *) slap_sl_mark LDAP_P((
void *ctx ));
LDAP_SLAPD_V (BerMemoryFunctions) slap_sl_mfuncs;

View file

@ -137,6 +137,9 @@ slap_sl_mem_destroy(
struct slab_object *so;
int i;
if (!sh)
return;
if (!sh->sh_stack) {
for (i = 0; i <= sh->sh_maxorder - order_start; i++) {
so = LDAP_LIST_FIRST(&sh->sh_free[i]);
@ -649,6 +652,21 @@ slap_sl_free(void *ptr, void *ctx)
}
}
void
slap_sl_release( void *ptr, void *ctx )
{
struct slab_heap *sh = ctx;
if ( sh && ptr >= sh->sh_base && ptr <= sh->sh_end )
sh->sh_last = ptr;
}
void *
slap_sl_mark( void *ctx )
{
struct slab_heap *sh = ctx;
return sh->sh_last;
}
/*
* Return the memory context of the current thread if the given block of
* memory belongs to it, otherwise return NULL.