Date: 2002-10-07 12:35:16
Hallo Ulrich, > cc65 has a complete malloc/free/realloc/... May I inform how CC65 handles the heap? The Idea I have is simple (at least that is what I think). The heap starts after the global variables unless the user tells something different. The first pointer pointer  points to the end of the reserved field + 1, the second one to the first pointer of the next field. If all reserved fields are successive, these two pointers are the same. If not, there is a gap that can be used. I even have been thinking about eliminating those gaps as well. Using new/malloc means that the address is unknown at the moment of creation thus an indirect call is needed ie. the program first has to look for the vector that points to the right field. The moment dispose/free creates a gap, the rest of the fields is moved. The only thing that has to be done now is updating that pointer. If this idea works, I even don't need the pointers mentioned above at  as the vector will do. OK, I need to reserve some space for storing the vectors but I thought about reserving only 16/32 bytes: 7 for the successive pointers , one pointer to next 16/32 bytes field.  the size of a pointer is normally 2 bytes but 4 bytes for 64+ KB systems. This includes the C64! Message was sent through the cbm-hackers mailing list
Archive generated by hypermail 2.1.4.