diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2022-12-01 02:05:19 +0200 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2022-12-01 02:05:19 +0200 |
| commit | 131af4eec38752a27e6e56579fbf76178e022ec1 (patch) | |
| tree | 1940634f69a44395fc6945b25c5cbc8b68bba876 /common/mem_regions.c | |
| parent | e25f1e7a8f8f2320546ad4950464713d85b47785 (diff) | |
| download | kmi-131af4eec38752a27e6e56579fbf76178e022ec1.tar.gz kmi-131af4eec38752a27e6e56579fbf76178e022ec1.zip | |
start looking into memory handling
+ Now 10M alloc/frees succeed, which totals more memory than the virtual
machine has, so no too obvious leaks are occuring. For future
debugging speed, changed 10M to 1M.
+ Also quick fix to rpcs, stacks are now assigned. Not entirely sure why
they worked before this, but good that I found it.
Diffstat (limited to 'common/mem_regions.c')
| -rw-r--r-- | common/mem_regions.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/common/mem_regions.c b/common/mem_regions.c index 8d066e7..eee9230 100644 --- a/common/mem_regions.c +++ b/common/mem_regions.c @@ -185,13 +185,15 @@ stat_t destroy_region(struct mem_region_root *r) * */ struct mem_region *find_used_region(struct mem_region_root *r, vm_t start) { + /** @todo check that start is aligned to page boundary? */ + vm_t ref = __page(start); struct sp_node *n = sp_root(&r->used_regions); while (n) { struct mem_region *t = mem_container(n); - if (start == t->start) + if (ref == t->start) return t; - if (start < t->start) + if (ref < t->start) n = sp_left(n); else n = sp_right(n); @@ -500,7 +502,7 @@ stat_t free_region(struct mem_region_root *r, vm_t start) if (!is_aligned(start, BASE_PAGE_SIZE)) return ERR_ALIGN; - struct mem_region *m = find_used_region(r, __page(start)); + struct mem_region *m = find_used_region(r, start); if (!m) return ERR_NF; |
