title: Do shared libraries use the same heap as the application?
body: <p>Say I have an application in Linux that uses shared libraries (<code>.so</code> files). My question is whether the code in those libraries will allocate memory in the same heap as the main application or do they use their own heap? </p>
  
  <p>So for example, some function in the <code>.so</code> file calls <code>malloc</code>, would it use the same heap manager as the application or another one? Also, what about the global data in those shared memories. Where does it lie? I know for the application it lies in the bss and data segment, but don't know where it is for those shared object files.</p>