title: Writing into a variable without knowing the total size in advance
body: <p>I need to modify an existing function, which is creating a file according to the configuration of the system. The total size of the created file is not known in advance. Thus, the original function simply creates a file and dumps everything into it. It even keeps some offsets in memory and updates the file during the process.</p>
  
  <p>I am not allowed to create a file on the disk. I need to keep everything in one single variable. However, I don't know the total size in advance.</p>
  
  <p>Can you suggest me a data structure for this case?</p>