Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » GridControl release memory (GridCtrl unable to reset memory usage)
GridControl release memory [message #49061] Mon, 11 December 2017 07:56 Go to previous message
chis.adrian is currently offline  chis.adrian
Messages: 3
Registered: December 2017
Location: Romania
Junior Member
Hi,
I have the following function:

void SelSqliteQuery( GridCtrl * MyGridCtrl ,std::string Qstr)
	{	
	
	 MyGridCtrl->RemoveColumn(0,MyGridCtrl->GetColumnCount() );
		MyGridCtrl->Reset();
		MyGridCtrl->Ready(false);
	
	
	sqlite3 * db;
	
	 if (sqlite3_open_v2(path_db.ToString().ToStd().c_str(),&db,SQLITE_OPEN_READWRITE,NULL)!=SQLITE_OK)
	 {
	  PromptOK("Can't create or open database file\n"); 
	 return;
	 }
	 
	  const char *quer = Qstr.c_str();
     sqlite3_stmt *statement;
	if(sqlite3_prepare_v2 (db, quer, -1, &statement, 0) != SQLITE_OK)
	{
		PromptOK("sqlite3_prepare_v2 FAILED \n"); 
		return;
	}
	
	int rows=0;
    int cols = sqlite3_column_count(statement);
    
	for (int CC=0;CC<cols;CC++)
	MyGridCtrl->AddColumn( (char*)sqlite3_column_name(statement, CC));
	
	while(true)
		{
			if( sqlite3_step(statement) == SQLITE_ROW)
			{
				  for(int col = 0; col < cols; col++)
				  MyGridCtrl->Set(rows,col, (char*)sqlite3_column_text(statement, col)); 	
			rows++;
			} else break;
		}
	
		sqlite3_finalize(statement);
 	 sqlite3_close(db);
 	 MyGridCtrl->Ready(true);
 	
	}



Well it work and its fast nice,
Problem is that this function is called many times as I want to create a small data base browser.
(I checked the function in other C++ app and for what I can tell ain't leaking)
Now when I select a big table memory goes up 400 mb acceptable its big but when I select a smaller one
memory remains same usage.
How can I reset ,delete ,clear whatever the memory usage.
Thank You.

 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: GridCtrl
Next Topic: SOLVED: Array and Grid on high definition monitor
Goto Forum:
  


Current Time: Wed Jun 18 12:54:26 CEST 2025

Total time taken to generate the page: 0.04812 seconds