linked list - Per-node memory overhead -


i learning pros , cons of using stacks linked lists, when found cons say: " memory cost each node can more databin stored. ex 32 bit value such integer can memory overhead 7 times larger integer itself."

what mean?

when use general memory allocator don't know how big block allocates on each request. many of them round requested size quantity each block aligned address divisible, say, 8 or 16, or 32. in case always use @ least 32 bytes, if request 1 byte. 32 bytes of heap 4-byte piece of data, 8 times need, overhead equal 7.

edit

often allocator adds 'header' before block returns , header size allocation size step. header 16 bytes long requested allocation size rounded nearest 16 multiply , incremented 16 header. requested size 1 through 16 use 32 bytes, 17—32 use 48, 33—48 it's 64 , on.


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -