2

I was observing the memory layout for different OpenCV applications (edge.cpp, for example) by looking at /proc/$PID/maps. As expected, there is a heap, and a stack as well as other expected segments. However, when I'm instrumenting these applications with my DebugTrace Pintool, the maps file doesn't show a heap. I was wondering how Pin changes the memory layout of applications and how could it possibly handle a large heap?

Pin user guide talks about how Pin and Pintools manage the memory they need. However, it doesn't explain how Pin changes the user program memory layout. Also, in this answer, Mackie points out that Pin changes memory layout but I was hoping for a more detailed answer.

I'm using Pin 3.7 under Fedora 24 with kernel 4.9 on an x86_64 machine.

dyster
  • 21
  • 2
  • What makes you think Pin modifies the app heap? – nitzanms Aug 19 '18 at 21:52
  • @nitzanms I record the memory layout of the application when I'm running it under pin and I can't find any heap label or any regions that looks like heap. – dyster Aug 20 '18 at 15:48
  • Pin doesn't normally interfere with heap allocations. It does perform its own allocations and has control of system calls, so any of those things may be confusing the code that marks things as heap. – nitzanms Aug 21 '18 at 08:05
  • @nitzanms That's correct. Pin doesn't **normally** change the memory layout of the application radically. That is why I was looking for details of Pin memory management. – dyster Aug 21 '18 at 17:20
  • I was hoping to write up a more detailed answer but I don't have the bandwidth. Generally changes in /proc/pid/maps are because when code executes in Pin context some assumptions that exist in the code that manufactures the mappings are violated. This does NOT mean Pin has been modifying the app's heap in a meaningful way. Maybe you can elaborate on what your goal is with this? – nitzanms Oct 15 '18 at 11:02
  • @nitzanms I was willing yo analyze the memory usage of different programs; to understand how sparse they use their virtual address space, what ranges of their virtual address space is used and so on. Also, I was interested in figuring out how much memory they allocate to the heap, stack, and different `mmap`ed files. – dyster Oct 19 '18 at 03:27

0 Answers0