summaryrefslogtreecommitdiffstats
path: root/ldap/servers/slapd/slapi2nspr.c
diff options
context:
space:
mode:
authorNoriko Hosoi <nhosoi@redhat.com>2008-10-15 06:30:11 +0000
committerNoriko Hosoi <nhosoi@redhat.com>2008-10-15 06:30:11 +0000
commit91d5d9d04a1a0137a6d16089c46f21771b62b3e2 (patch)
tree5668b30e432c29eac8a4dfbf8eebff02af603c35 /ldap/servers/slapd/slapi2nspr.c
parentf7bc5b0691f58138eeb7783af9743de4410b46c4 (diff)
downloadds-91d5d9d04a1a0137a6d16089c46f21771b62b3e2.tar.gz
ds-91d5d9d04a1a0137a6d16089c46f21771b62b3e2.tar.xz
ds-91d5d9d04a1a0137a6d16089c46f21771b62b3e2.zip
Resolves: #466702
Summary: Memory usage research: checking in the experimental code See also: http://directory.fedoraproject.org/wiki/Memory_Usage_Research
Diffstat (limited to 'ldap/servers/slapd/slapi2nspr.c')
-rw-r--r--ldap/servers/slapd/slapi2nspr.c40
1 files changed, 34 insertions, 6 deletions
diff --git a/ldap/servers/slapd/slapi2nspr.c b/ldap/servers/slapd/slapi2nspr.c
index d5d583dc..ebe2e451 100644
--- a/ldap/servers/slapd/slapi2nspr.c
+++ b/ldap/servers/slapd/slapi2nspr.c
@@ -214,6 +214,12 @@ slapi_notify_condvar( Slapi_CondVar *cvar, int notify_all )
return( prrc == PR_SUCCESS ? 1 : 0 );
}
+#ifdef MEMPOOL_EXPERIMENTAL
+void _free_wrapper(void *ptr)
+{
+ slapi_ch_free(&ptr);
+}
+#endif
/*
* Function: slapi_ldap_init()
@@ -239,18 +245,40 @@ slapi_ldap_init( char *ldaphost, int ldapport, int secure, int shared )
* Note that ldapssl_init() uses libprldap implicitly.
*/
+#ifdef MEMPOOL_EXPERIMENTAL
+ {
+ /*
+ * slapi_ch_malloc functions need to be set to LDAP C SDK
+ */
+ struct ldap_memalloc_fns memalloc_fns;
+ memalloc_fns.ldapmem_malloc = (LDAP_MALLOC_CALLBACK *)slapi_ch_malloc;
+ memalloc_fns.ldapmem_calloc = (LDAP_CALLOC_CALLBACK *)slapi_ch_calloc;
+ memalloc_fns.ldapmem_realloc = (LDAP_REALLOC_CALLBACK *)slapi_ch_realloc;
+ memalloc_fns.ldapmem_free = (LDAP_FREE_CALLBACK *)_free_wrapper;
+ }
+ /*
+ * MEMPOOL_EXPERIMENTAL:
+ * These LDAP C SDK init function needs to be revisited.
+ * In ldap_init called via ldapssl_init and prldap_init initializes
+ * options and set default values including memalloc_fns, then it
+ * initializes as sasl client by calling sasl_client_init. In
+ * sasl_client_init, it creates mechlist using the malloc function
+ * available at the moment which could mismatch the malloc/free functions
+ * set later.
+ */
+#endif
if ( secure ) {
ld = ldapssl_init( ldaphost, ldapport, secure );
} else {
ld = prldap_init( ldaphost, ldapport, shared );
}
- /* Update snmp interaction table */
- if ( ld == NULL) {
- set_snmp_interaction_row( ldaphost, ldapport, -1);
- } else {
- set_snmp_interaction_row( ldaphost, ldapport, 0);
- }
+ /* Update snmp interaction table */
+ if ( ld == NULL) {
+ set_snmp_interaction_row( ldaphost, ldapport, -1);
+ } else {
+ set_snmp_interaction_row( ldaphost, ldapport, 0);
+ }
if ( ld != NULL ) {
/*