I am now thinking there must be an easy way to fire off this query in a different datasession or thread so that any problems caused by the ODBC driver are lost after each execution, any brilliant ideas?
Memory is allocated on the process level and not automatically freed when the thread that allocate a block is terminated. If it is a faulty driver, you need to create a new process from time to time. Options would be to put this part of your application into a EXE COM Server that you occasionally release and re-create, a separate EXE that you launch or by letting your application restart itself every x iterations.
You haven't said anything about which ODBC driver this is. Maybe there is an updated version available? Or maybe there is another vendor with drivers for the same database (Oracle DBs have multiple options, for instance).