title: ipc - shm - will string remain in memory until system reboot?
body: <p><code>"abc"</code> string was stored to shared memory.</p>
  
  <p>The program has finished (quit) by    <code>return 0;</code> but the string is still stored in memory.</p>
  
  <ul>
  <li><p>How long will it remain there?</p></li>
  <li><p>Will it remain there until system reboot?</p></li>
  <li><p>Can it be relied on that it will remain there?</p></li>
  </ul>
  
  <p>Relevant code:</p>
  
  <pre><code>int main() {
  
      int mem_id;
      key_t key;
      char * string;
  
      key = 01;
  
      int str_len;
      str_len = strlen("abc") + 1;
  
      mem_id = shmget(key, str_len, IPC_CREAT | 0666);
      string = shmat(mem_id, NULL, 0);
  
      strcpy ( string, "abc" );
  
      return 0;
  }
  </code></pre>