Page 1 of 1

[Solved]Memory allocation corruption problems

Posted: Mon Feb 08, 2016 6:05 pm
by Vild
Edit: My paging code was the issue the whole time.
Thanks for everything anyway guys.

--------

Hi!
I'm having some trouble with getting my memory manager working.
My linked list root entry gets corrupted after a big number of frame allocations, I'm think I am somehow accessing reserved memory.
But I'm really unsure if that is the case or if my paging code is wrong.

The problem is that after 137 frame allocation the root elements .prev somehow points to itself and creates a infinite-loop, when I try to combine free chunks.
If I add a check here https://github.com/Vild/PowerNex/blob/O ... eap.d#L103, to make sure that freeChunk is not equal to freeChunk.prev, I get a General Protection fault after 192 frame allocations.

Hopefully someone can help me find what I am doing wrong or point me in the right direction.
All help is appreciated.
- Dan

Debug output (COM1)
QEMU interrupt output
The code for the heap: heap.d

The General protection interrupt log files:
Debug output (COM1)
QEMU interrupt output

Prebuild iso: http://wild.tk/powernex.iso (20Mb)
Prebuild iso with the .prev check: http://wild.tk/powernexGE.iso (20Mb)
Github: https://github.com/Vild/PowerNex/tree/O ... src/memory The code is written in D.

Re: Memory allocation corruption problems

Posted: Tue Feb 09, 2016 5:25 pm
by shmx
Try to make a version for user space and use the unit testing.

Re: Memory allocation corruption problems

Posted: Thu Feb 11, 2016 4:29 pm
by Vild
shmx wrote:Try to make a version for user space and use the unit testing.
I realized that my whole code was really dumb made, and it seems like my paging code was behind the whole thing so I'm starting to redesign it.
Thanks anyway ;)