title: System.Data.SQLite : VACUUM INTO an in-memory database
body: <p>First I use <a href="https://www.nuget.org/packages/System.Data.SQLite.Core/1.0.111" rel="nofollow noreferrer">System.Data.SQLite v1.0.111</a> to open a connection to in-memory database as below.</p>
  
  <pre><code>SQLiteConnection dest= new SQLiteConnection("FullUri='file:db1?mode=memory&amp;cache=shared'");
  dest.Open();
  </code></pre>
  
  <p>Then I have another sqlite database on file which is opened as below.</p>
  
  <pre><code>SQLiteConnection src= new SQLiteConnection(@"Data Source=C:\db1.sqlite");
  src.Open();
  </code></pre>
  
  <p>Next, I tried to <code>VACUUM INTO</code> SQL to copy the file database into in-memory database, and it gave me an error.</p>
  
  <pre><code>using( SQLiteCommand cmd = src.CreateCommand() )
  {
      cmd.CommandText = $"VACUUM main INTO 'file:db1?mode=memory&amp;cache=shared';";
      cmd.ExecuteNonQuery();
  }
  </code></pre>
  
  <blockquote>
    <p>SQLiteException: out of memory</p>
  </blockquote>
  
  <pre><code>   at System.Data.SQLite.SQLite3.Reset(SQLiteStatement stmt)
     at System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt)
     at System.Data.SQLite.SQLiteDataReader.NextResult()
     at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave)
     at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior)
     at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery(CommandBehavior behavior)
     at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery()
  </code></pre>
  
  <p>The database in file is small(20KB),  but it says out of memory?</p>
  
  <p>Thank you</p>