|
@ -1206,14 +1206,14 @@ int32_t zeroval() { return(0); } |
|
|
|
|
|
|
|
|
void *LP_alloc(uint64_t len) |
|
|
void *LP_alloc(uint64_t len) |
|
|
{ |
|
|
{ |
|
|
return(calloc(1,len)); |
|
|
//return(calloc(1,len));
|
|
|
LP_cjson_allocated += len; |
|
|
LP_cjson_allocated += len; |
|
|
LP_cjson_total += len; |
|
|
LP_cjson_total += len; |
|
|
LP_cjson_count++; |
|
|
LP_cjson_count++; |
|
|
struct LP_memory_list *mp; |
|
|
struct LP_memory_list *mp; |
|
|
mp = calloc(1,sizeof(*mp) + len); |
|
|
mp = calloc(1,sizeof(*mp) + len); |
|
|
mp->ptr = calloc(1,len); |
|
|
mp->ptr = calloc(1,len); |
|
|
//printf(">>>>>>>>>>> LP_alloc mp.%p ptr.%p len.%llu %llu\n",mp,mp->ptr,(long long)len,(long long)LP_cjson_allocated);
|
|
|
printf(">>>>>>>>>>> LP_alloc mp.%p ptr.%p len.%llu %llu\n",mp,mp->ptr,(long long)len,(long long)LP_cjson_allocated); |
|
|
mp->timestamp = (uint32_t)time(NULL); |
|
|
mp->timestamp = (uint32_t)time(NULL); |
|
|
mp->len = (uint32_t)len; |
|
|
mp->len = (uint32_t)len; |
|
|
portable_mutex_lock(&LP_cJSONmutex); |
|
|
portable_mutex_lock(&LP_cJSONmutex); |
|
@ -1225,7 +1225,7 @@ return(calloc(1,len)); |
|
|
void LP_free(void *ptr) |
|
|
void LP_free(void *ptr) |
|
|
{ |
|
|
{ |
|
|
static uint32_t lasttime,unknown; |
|
|
static uint32_t lasttime,unknown; |
|
|
free(ptr); return; |
|
|
//free(ptr); return;
|
|
|
uint32_t now; char str[65]; int32_t n,lagging; uint64_t total = 0; struct LP_memory_list *mp,*tmp; |
|
|
uint32_t now; char str[65]; int32_t n,lagging; uint64_t total = 0; struct LP_memory_list *mp,*tmp; |
|
|
if ( (now= (uint32_t)time(NULL)) > lasttime+60 ) |
|
|
if ( (now= (uint32_t)time(NULL)) > lasttime+60 ) |
|
|
{ |
|
|
{ |
|
@ -1262,7 +1262,7 @@ free(ptr); return; |
|
|
portable_mutex_lock(&LP_cJSONmutex); |
|
|
portable_mutex_lock(&LP_cJSONmutex); |
|
|
DL_DELETE(LP_memory_list,mp); |
|
|
DL_DELETE(LP_memory_list,mp); |
|
|
portable_mutex_unlock(&LP_cJSONmutex); |
|
|
portable_mutex_unlock(&LP_cJSONmutex); |
|
|
//printf(">>>>>>>>>>> LP_free ptr.%p mp.%p len.%u %llu\n",ptr,mp,mp->len,(long long)LP_cjson_allocated);
|
|
|
printf(">>>>>>>>>>> LP_free ptr.%p mp.%p len.%u %llu\n",ptr,mp,mp->len,(long long)LP_cjson_allocated); |
|
|
free(mp->ptr); |
|
|
free(mp->ptr); |
|
|
free(mp); |
|
|
free(mp); |
|
|
} else unknown++; // free from source file with #define redirect for alloc that wasnt
|
|
|
} else unknown++; // free from source file with #define redirect for alloc that wasnt
|
|
|