diff --git a/lib/MySQL_Authentication.cpp b/lib/MySQL_Authentication.cpp index 35d7962df..c81ab36ab 100644 --- a/lib/MySQL_Authentication.cpp +++ b/lib/MySQL_Authentication.cpp @@ -157,6 +157,9 @@ unsigned int MySQL_Authentication::memory_usage() { if (ado->sha1_pass) ret += SHA_DIGEST_LENGTH; if (ado->default_schema) ret += strlen(ado->default_schema) + 1; } + ret += sizeof(creds_group_t); + ret += sizeof(PtrArray); + ret += (creds_frontends.cred_array->size * sizeof(void *)); for (i=0; ilen; i++) { account_details_t *ado=(account_details_t *)creds_backends.cred_array->index(i); ret += sizeof(account_details_t); @@ -165,6 +168,9 @@ unsigned int MySQL_Authentication::memory_usage() { if (ado->sha1_pass) ret += SHA_DIGEST_LENGTH; if (ado->default_schema) ret += strlen(ado->default_schema) + 1; } + ret += sizeof(creds_group_t); + ret += sizeof(PtrArray); + ret += (creds_backends.cred_array->size * sizeof(void *)); #ifdef PROXYSQL_AUTH_PTHREAD_MUTEX pthread_rwlock_unlock(&creds_frontends.lock); pthread_rwlock_unlock(&creds_backends.lock); diff --git a/lib/Query_Processor.cpp b/lib/Query_Processor.cpp index bf398cf1c..f4d4b9b07 100644 --- a/lib/Query_Processor.cpp +++ b/lib/Query_Processor.cpp @@ -684,6 +684,12 @@ unsigned long Query_Processor::get_query_digests_total_size() { if (qds->digest_text) ret += strlen(qds->digest_text) + 1; } +#if !defined(__FreeBSD__) && !defined(__APPLE__) + ret += ((sizeof(uint64_t) + sizeof(void *) + sizeof(std::_Rb_tree_node_base)) * digest_umap.size() ); +#else + ret += ((sizeof(uint64_t) + sizeof(void *) + 32) * digest_umap.size() ); +#endif + #ifdef PROXYSQL_QPRO_PTHREAD_MUTEX pthread_rwlock_unlock(&digest_rwlock); #else