Skip to content
Snippets Groups Projects
Commit 3df58d69 authored by Wesley W. Terpstra's avatar Wesley W. Terpstra
Browse files

Useful when debugging

parent d6b56ff6
No related merge requests found
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "memory.h" #include "memory.h"
EB_POINTER(eb_memory_item) eb_memory_free = EB_END_OF_FREE; EB_POINTER(eb_memory_item) eb_memory_free = EB_END_OF_FREE;
EB_POINTER(eb_memory_item) eb_memory_used = 0;
static EB_POINTER(eb_new_memory_item) eb_new_memory_item(void) { static EB_POINTER(eb_new_memory_item) eb_new_memory_item(void) {
EB_POINTER(eb_memory_item) alloc; EB_POINTER(eb_memory_item) alloc;
...@@ -45,12 +46,14 @@ static EB_POINTER(eb_new_memory_item) eb_new_memory_item(void) { ...@@ -45,12 +46,14 @@ static EB_POINTER(eb_new_memory_item) eb_new_memory_item(void) {
alloc = eb_memory_free; alloc = eb_memory_free;
eb_memory_free = EB_FREE_ITEM(alloc)->next; eb_memory_free = EB_FREE_ITEM(alloc)->next;
++eb_memory_used;
return alloc; return alloc;
} }
static void eb_free_memory_item(EB_POINTER(eb_memory_item) item) { static void eb_free_memory_item(EB_POINTER(eb_memory_item) item) {
EB_FREE_ITEM(item)->next = eb_memory_free; EB_FREE_ITEM(item)->next = eb_memory_free;
eb_memory_free = item; eb_memory_free = item;
--eb_memory_used;
} }
eb_operation_t eb_new_operation (void) { return (eb_operation_t) eb_new_memory_item(); } eb_operation_t eb_new_operation (void) { return (eb_operation_t) eb_new_memory_item(); }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment