title: Dump global datas to disk in assembly code
body: <p>The experiment is on Linux, x86 32-bit. </p>
  
  <p>So suppose in my assembly program, I need to periodically (for instance every time after executing 100000 basic blocks) dump an array in .bss section from memory to the disk.  The starting address and size of the array is fixed. The array records the executed basic block's address, the size is 16M right now.</p>
  
  <p>I tried to write some native code, to <code>memcpy</code> from .bss section to the stack,  and then write it back to disk. But it seems to me that it is very tedious and I am worried about the performance and memory consumption, say, every-time allocate a very large memory on the stack...</p>
  
  <p>So here is my question, how can I dump the memory from global data sections in an efficient way? Am I clear enough? </p>