using orxLINKLIST

edited May 2013 in Help request
I was looking to have a linked list of 32 bit pointers. It seems that I then have to allocate 4-byte sturctures consisting of orxLINKLIST_NODE and my pointer, then add them at the end of the orxLINKLIST. I am not too hot on dynamically allocating such small chunks of memory, however. Does orxMemory_Allocate do anything to help with this?

Comments

  • edited May 2013
    I'd recommend using orxBANK for your memory needs.
    It'll actually allocate memory chunks, make sure they're nicely aligned on cache-line size and do all the bookkeeping for you.

    Slots are not actually freed/reallocated, simply re-used when available, for more efficiency.

    All allocations are indexed and the index can be requested if need be.

    orxBANK also use a high-watermark approach and will keep empty chunks/slots instead of de-allocating them.
    If you want to return the memory, calling orxBank_Compact() should do the trick and will free any empty chunks.
  • edited May 2013
    Very interesting, I will look into using the memory bank. Thank you.
  • edited May 2013
    My pleasure. There's also some ordering coming with banks (orxBank_GetNext()), but it won't be as efficient as using an orxLINKLIST. It all depends on your intended use, I guess.
Sign In or Register to comment.