You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by GitBox <gi...@apache.org> on 2020/03/27 16:51:04 UTC

[GitHub] [qpid-dispatch] kgiusti commented on a change in pull request #711: Added debug-dump backtrace for leaked objects in pooled memory.

kgiusti commented on a change in pull request #711: Added debug-dump backtrace for leaked objects in pooled memory.
URL: https://github.com/apache/qpid-dispatch/pull/711#discussion_r399404250
 
 

 ##########
 File path: src/alloc_pool.c
 ##########
 @@ -501,11 +537,25 @@ void qd_alloc_finalize(void)
         // Check the stats for lost items
         //
 #if QD_MEMORY_STATS
-        if (dump_file && desc->stats->total_free_to_heap < desc->stats->total_alloc_from_heap)
+        if (dump_file && desc->stats->total_free_to_heap < desc->stats->total_alloc_from_heap) {
             fprintf(dump_file,
                     "alloc.c: Items of type '%s' remain allocated at shutdown: %"PRId64"\n",
                     desc->type_name,
                     desc->stats->total_alloc_from_heap - desc->stats->total_free_to_heap);
+#ifdef QD_MEMORY_DEBUG
+            qd_alloc_type_t *qtype = (qd_alloc_type_t*) desc->debug;
+            qd_alloc_item_t *item = DEQ_HEAD(qtype->allocated);
+            while (item) {
+                size_t i;
+                char   **strings;
+                strings = backtrace_symbols (item->backtrace, item->backtrace_size);
 
 Review comment:
   IIUC *strings needs to be freed manually

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org