From 8e2feae84c53e05013d15ae18674ddccd5b07a2e Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 16 Nov 2017 01:26:35 +0200 Subject: [PATCH] Test --- iguana/exchanges/LP_nativeDEX.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index d1cbba606..a4e5131f5 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -1229,7 +1229,6 @@ void LP_free(void *ptr) if ( (now= (uint32_t)time(NULL)) > lasttime+6 ) { n = lagging = 0; - portable_mutex_lock(&LP_cJSONmutex); DL_FOREACH_SAFE(LP_memory_list,mp,tmp) { total += mp->len; @@ -1237,12 +1236,16 @@ void LP_free(void *ptr) if ( now > mp->timestamp+60 ) { lagging++; - DL_DELETE(LP_memory_list,mp); - free(mp->ptr); - free(mp); + if ( now > mp->timestamp+600 ) + { + portable_mutex_lock(&LP_cJSONmutex); + DL_DELETE(LP_memory_list,mp); + portable_mutex_unlock(&LP_cJSONmutex); + free(mp->ptr); + free(mp); + } } } - portable_mutex_unlock(&LP_cJSONmutex); printf("total %d allocated total %llu %s unknown.%u lagging.%d\n",n,(long long)total,mbstr(str,total),unknown,lagging); lasttime = (uint32_t)time(NULL); }