Hi Robert, I was talking about 3 selects satements using the same connections. Anyway, thank you very much for your advice of using "PRAGMA cache size=8", that solved all the problems related to sqlite3_exec memory problems with a select statement, baut the memory problems are not solved at all, stilll i get a memory leak when using sqlite3_get_table, even if i use sqlite3_free_table not all the memory is freed. Someone pointed that this might be an error on the source code becuse the ARM processor architecture is quite different from the X86 processor. I have been taking a look at the table.c file but i am not that good programer, to see if anything fails, Do you see anything on the table.c that might be generating the problem?. I have attached to this email a memory graphic of sqlite3_get_table problem
---Mensaje original-------- Original Message ----- From: > I have run your program on the CE emulator (Pocket PC 2003) > and i got the same memory leak. > I have inserted 2 buttons on a MFC dialog application. > The first button executes your code and the second button > closes the application. > If you examine the memory you will discover that the program > only free the memory once you exit from the apllication, > meanwhile it reserves memory as its needed (on demand, but > see details below). > the memory behaviour of SQLite is quite strange, an example: > lets say that a select sentence reserves 1000kb of memory, > once this local process has finished memory keeps reserved > for the program (it should be freed), if another process > executes a select sentence that needs 200kb SQLite will not > reserve 200k more, it will use 200k of the previous 1000k > reserved. if a 3rd process executes a select sentence that > needs 1300k SQlite will reserve 300kb more and those 1300kb > will not be freed until the main dialog application closes > (even if the 3 process where local methods or functions). Ok this is where you lost me. 3 processes? Is your program running 3 times on the CE platform? If CE is running 3 instances of your program, then they definitely won't be sharing any memory and yes you'll definitely run out. Also if I recall correctly, CE 5.0 will not let you run multiple instances of the same program. If you're talking about 3 SELECT statements in the same program using the same connection instance, then that's another story. > The problem is that if a select sentence consume most of the > memory it will not be freed and the program will execute very > slow until you exit from the application because there will > be so little memory left for other not SQLite process that > the program might be unusable. SQLite's default cache size is about 3mb. After opening a connection, try executing "PRAGMA cache_size=8" or some really low number and tell me if its still "leaking". Robert El día del padre está cerca... ¿Ya tienes el regalo? http://buscawanadoo.es/search?type=pref&destino=web&origen=homespot&buscar=Regalos%20Día%20del%20Padre