summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJosé Fonseca <jrfonseca@tungstengraphics.com>2008-05-07 16:29:36 +0900
committerJosé Fonseca <jrfonseca@tungstengraphics.com>2008-05-07 16:29:36 +0900
commit4d1bf8a85eae730ca875194864277602f57582ea (patch)
tree9b1e0e97ae6c33381b017ecf348db3ae34da5487 /src
parentc7ad942c54c3892a98d248a15af817f256260e75 (diff)
gallium: Output the total of leaked memory.
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/util/p_debug_mem.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/util/p_debug_mem.c b/src/gallium/auxiliary/util/p_debug_mem.c
index 3b5e4fbaee..78497c5f6a 100644
--- a/src/gallium/auxiliary/util/p_debug_mem.c
+++ b/src/gallium/auxiliary/util/p_debug_mem.c
@@ -211,6 +211,7 @@ debug_memory_begin(void)
void
debug_memory_end(unsigned long start_no)
{
+ size_t total_size = 0;
struct list_head *entry;
entry = list.prev;
@@ -220,9 +221,15 @@ debug_memory_end(unsigned long start_no)
hdr = LIST_ENTRY(struct debug_memory_header, entry, head);
ptr = data_from_header(hdr);
if(start_no <= hdr->no && hdr->no < last_no ||
- last_no < start_no && (hdr->no < last_no || start_no <= hdr->no))
+ last_no < start_no && (hdr->no < last_no || start_no <= hdr->no)) {
debug_printf("%s:%u:%s: %u bytes at %p not freed\n",
hdr->file, hdr->line, hdr->function,
hdr->size, ptr);
+ total_size += hdr->size;
+ }
+ }
+ if(total_size) {
+ debug_printf("Total of %u KB of system memory apparently leaked\n",
+ (total_size + 1023)/1024);
}
}