How to release memory of mysql connection open when working on c# -


mysqlconnection con = null; con = new mysqlconnection(); con.connectionstring = @"connection_string"; mysqlcommand cmd = new mysqlcommand(); cmd.connection = con;  try {       con.open();   //its increasing memory size 4 mb        ///--------------------------logic----------------------//        ///------------------------------------------------------//     con.close();  //it not work : memory not reallocate. } catch {  }     

  1. try use try - final block , close connections / commands on final block or use using statement

  2. use connection pool, connections re-used , amount of memory won't go higher amount.

what observe here (not clearing memory when close connection), because if close connection gc won't collecting effective immediately, , won't trigger until application maxed out stack


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -