Ciao,
ho un programma che lancia dei thread per fare delle elaborazioni su un database mysql.
In alcuni casi deve estrarre dei dati e scriverli su un file xml.

Per estrarre i dati uso il driver di mysql MySQLDriverCS così:
codice:
myDBCmd.CommandText = query;
myDBCmd.Connection = myDBConn;
		
//create a new DataReader with the result of the executed statement 

MySQLDriverCS.MySQLDataReader myRdr = myDBCmd.ExecuteReaderEx();

while (myRdr.Read()) 
{
   // qui scrivo il file
}

myRdr.Close();
Il problema è che quando 2 di questi thread fanno questa operazione con un breve intervallo di tempo il programma mi va in OutOfMemoryException.

C'è un modo per leggere i dati da mysql che usa meno memoria?