Page 1 of 1

New upload: Fragmentation demo of heap memory manager in banked ram

Posted: Wed Dec 22, 2021 5:49 am
by svenvandevelde



Fragmentation demo of heap memory manager in banked ram




View File






A demo showing a heap memory manager being functional, dynamically allocating and freeing memory blocks of various sizes in banked memory of the CX16.






 

New upload: Fragmentation demo of heap memory manager in banked ram

Posted: Wed Dec 22, 2021 4:27 pm
by ZeroByte

Can you go into a little more detail about what it is I'm looking at? I'm interested in this library as dealing with HiRam is quite a PITA. What's the narrow band at the top? Low RAM? Is data being moved between Hi and Lo RAM?


New upload: Fragmentation demo of heap memory manager in banked ram

Posted: Wed Dec 22, 2021 6:21 pm
by svenvandevelde


On 12/22/2021 at 5:27 PM, ZeroByte said:




Can you go into a little more detail about what it is I'm looking at? I'm interested in this library as dealing with HiRam is quite a PITA. What's the narrow band at the top? Low RAM? Is data being moved between Hi and Lo RAM?



All data is managed in hi-ram. That is banked ram. From address 0x2000 till 0x44000, assuming that the banked ram is a continuous space. (We both know it is not). So divide 0x44000 / 0x2000, which gives 22 banks. However the index is managed in bank 1 of bram, so 20 banks of 0x2000 bytes are used for the heap. Bank 0 is unused. 

The heap allocation starts from the top moving down. 

I'll post the source code of the heap manager later once I'm behind my laptop. 

I'm stil optimizing it though...

Sven


New upload: Fragmentation demo of heap memory manager in banked ram

Posted: Thu Dec 23, 2021 6:15 am
by svenvandevelde


On 12/22/2021 at 5:27 PM, ZeroByte said:




Can you go into a little more detail about what it is I'm looking at? I'm interested in this library as dealing with HiRam is quite a PITA. What's the narrow band at the top? Low RAM? Is data being moved between Hi and Lo RAM?



Here you are my friend @ZeroByte

cx16-heap-test-fragmentation.c

cx16-heap.h

cx16-heap.c

The complete compiler source code can be found here in a branch:

src/main/kc/lib/cx16-heap.c · CX16_HEAP · Sven Van de Velde / kickc · GitLab


New upload: Fragmentation demo of heap memory manager in banked ram

Posted: Sun Jan 02, 2022 12:02 pm
by svenvandevelde

I have the latest updates moved to my cx16 coding area on github. Moving the heap manager out of the kickc compiler did the moment but as a side compile.

https://github.com/FlightControl-User/X16_Code/blob/main/cx16_lib/cx16-heap.c

An open work item is to be able to configure that allocated blocks are not crossing $a000 - $buff bank boundaries. This is important for data structures. The data elements in the structure must be stored in sequential memory space.  For bitmap data such boundary crossing would not be a problem though. 

For example, if at address $A008 a block would be allocated of 16 bytes, then this would require the remaining 8 to be registered as idle, and the 16 bytes to be allocated from $C000 downwards, with base $BFF0.

 


New upload: Fragmentation demo of heap memory manager in banked ram

Posted: Sat Jan 29, 2022 10:13 am
by svenvandevelde


On 12/22/2021 at 5:27 PM, ZeroByte said:




Can you go into a little more detail about what it is I'm looking at? I'm interested in this library as dealing with HiRam is quite a PITA. What's the narrow band at the top? Low RAM? Is data being moved between Hi and Lo RAM?



Still interested?