It's *extremely* unlikely that you "... need to write a memory profiler for an embedded system that runs a linux kernel".
If you've got a Linux kernel ... then you've probably got a memory profiler ... for FREE.
More specifically, you've got a CHOICE of many DIFFERENT profiling and performance analysis tools for free.
"Free" as in "you don't have to re-invent the wheel" (vs "freedom", "beer" or skittles ;-))
Buy either of these two (most excellent!) books. They'll literally pay for themselves within a page or two. Honest!
"Building Embedded Linux Systems", Yahgmour et al
"Embedded Linux Primer", Hallinan
'Hope that helps .. PSM