How to find out memory layout of your data structure implementation on Linux 64bit machine
- by ajay
In this article, http://cacm.acm.org/magazines/2010/7/95061-youre-doing-it-wrong/fulltext
the author talks about the memory layouts of 2 data structures - The Binary Heap and the B-Heap and compares how one has better memory layout than the other.
http://deliveryimages.acm.org/10.1145/1790000/1785434/figs/f5.jpg
http://deliveryimages.acm.org/10.1145/1790000/1785434/figs/f6.jpg
I want to get hands on experience on this. I have an implementation of a N-Ary Tree and I want to find out the memory layout of my data structure. What is the best way to come up with a memory layout like the one in the article?
Secondly, I think it is easier to identify the memory layout if it is an array based implementation. If the implementation of a Tree uses pointers then what Tools do we have or what kind of approach is required to map it's memory layout?
Thanks!