summaryrefslogtreecommitdiffstats
path: root/lib/resource.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/resource.h')
-rw-r--r--lib/resource.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/resource.h b/lib/resource.h
index 8dd441f..5cb5e27 100644
--- a/lib/resource.h
+++ b/lib/resource.h
@@ -26,8 +26,12 @@ struct resclass {
void (*free)(resource *); /* Freeing function */
void (*dump)(resource *); /* Dump to debug output */
resource *(*lookup)(resource *, unsigned long); /* Look up address (only for debugging) */
+ size_t (*memsize)(resource *); /* Return size of memory used by the resource, may be NULL */
};
+/* Estimate of system allocator overhead per item, for memory consumtion stats */
+#define ALLOC_OVERHEAD 8
+
/* Generic resource manipulation */
typedef struct pool pool;
@@ -36,6 +40,7 @@ void resource_init(void);
pool *rp_new(pool *, char *); /* Create new pool */
void rfree(void *); /* Free single resource */
void rdump(void *); /* Dump to debug output */
+size_t rmemsize(void *res); /* Return size of memory used by the resource */
void rlookup(unsigned long); /* Look up address (only for debugging) */
void rmove(void *, pool *); /* Move to a different pool */