umm_malloc icon indicating copy to clipboard operation
umm_malloc copied to clipboard

Heap initialization value other than zero.

Open user2222222222 opened this issue 8 months ago • 4 comments

It would be nice to be able to initialize the heap to something other than zero (such as a checker pattern: 0x55). #define UMM_HEAPINIT 0x55

It looks like these are the only changes needed in umm_multi_init_heap(), but thought I'd bring it up here in case you think it's worth adding, but mainly to make sure I'm not missing something:

    memset(UMM_HEAP, UMM_HEAPINIT, UMM_HEAPSIZE);

    UMM_NBLOCK(0) = 1;
    UMM_PBLOCK(0) = 0;
    UMM_NFREE(0) = 1;
    UMM_PFREE(0) = 1;

    UMM_NBLOCK(1) = UMM_BLOCK_LAST | UMM_FREELIST_MASK;
    UMM_PBLOCK(1) = 0;
    UMM_NFREE(1) = 0;
    UMM_PFREE(1) = 0;

    UMM_NBLOCK(UMM_BLOCK_LAST) = 0;
    UMM_PBLOCK(UMM_BLOCK_LAST) = 1;
    UMM_NFREE(UMM_BLOCK_LAST) = 0;
    UMM_PFREE(UMM_BLOCK_LAST) = 0;

user2222222222 avatar Jun 06 '24 19:06 user2222222222