hi, i am evaluating sqlite performance for mobile platform now.
i found something discussable about memory footprint and leakage. the highest water line of memeory usage is 44611bytes (by malloc() ), and there seems a large memory leakage (34017bytes) in my testing scenario. 'cache_size' is set to the smallest, '1', but i dont know why it still use so much. for low-profile mobile platforms, such amount seems too much. can somebody tell me something about this? -----the way i measure the memroy usage---- in os_common.h sqlite3GenericMalloc(int n){ char *p = (char *)malloc(n+8); ... ... if( p ){ *(int *)p = n; } currentMemoryConsumption += n; if (currentMemoryConsumption > maxMemoryConsuption) { maxMemoryConsuption = currentMemoryConsumption; } return (void *)p; } void sqlite3GenericFree(void *p){ assert(p); currentMemoryConsumption -= *((int*) ((char*)p - 8)); ... ... } --------------------------testing scenario-------------------------------------- the testing is done with windows filesystem, cache_size=1; page_size = 1k (default), the database being operated on contains 250 enties, no index: contacts.db size: 7,168 bytes
CREATE TABLE contacts (name text,phone int);
A.H.|1439 Abel|1654 Absalonsgade,|1658 ... ... the queries are: select number from contacts where rowid = 1 select number from contacts where rowid = 125 select number from contacts where rowid = 64 INSERT INTO contacts values('kim','0000') INSERT INTO contacts values('wang','0000') update contacts set phone='34' where name = 'kim' update contacts set phone='71' where name = 'wang' update contacts set phone='0000' where name = 'Eskildsgade,' update contacts set phone='0000' where name = 'Bustrupgade,' begin INSERT INTO contacts VALUES('abc','49') INSERT INTO contacts VALUES('klaus','41') update contacts set phone='1657' where name = 'Eskildsgade,' update contacts set phone='1737' where name = 'Bustrupgade,' delete from contacts where name = 'abc' delete from contacts where name = 'klaus' commit delete from contacts where name = 'kim' delete from contacts WHERE name = 'wang' delete from contacts where name = 'Eskildsgade,' delete from contacts WHERE name = 'Bustrupgade,'