I have this piece of code that executes update scripts on the database. I have 20 .sql files that contains about 400 update scripts. The overall size of the files is around 60MB. When I execute all the update scripts, it eats up about 400 MB of RAM and doesn't free it. I'm looking for ways to optimize this code.private void ExeCuteCommand(SqlConnection conn, string script, bool flag)    {        SqlCommand command = new SqlCommand();        command.Connection = conn;        command.CommandType = CommandType.Text;        command.CommandText = script;        if (flag)            command.ExecuteNonQuery();                   }EDIT: This is the calling method, basicall what it does is loop through the files, get the contents and pass the contents to the ExecuteCommand method.private void ExecuteUpdateScripts(SqlConnection conn)    {        int step = 1;        foreach (string update in Directory.GetFiles(scriptDirectory, @SCRIPT UPDATE ??.sql))        {            string updateScript = File.ReadAllText(updateSQL);            ExeCuteCommand(conn, updateScript, true);            step++;        }    }I have looked at the Visual Studio profiler and this is the line the consumes a lot of memory command.ExecuteNonQuery();
SQL update scripts taking too much memory and doesn't free it up
c#;sql