Sarah wrote: >> Because uc/os-II doesn't provide malloc(), free() to manage memory, >> instead, it divides the memory into fixed-length blocks and >> provides OSMemGet() and OSMemPut() to get and put fixed-length >> memory block. >> >> In order to port SQLite, I have to wrap uc/os-II with a set of >> standard memory management APIs(malloc, free...). So I need to >> decide in advance that which 'fixed length' will be better. That is >> to say, when using malloc() to allocate memory in SQLite, how much >> memory is needed in most cases? what does it depend on?
I suspect nobody really knows. I don't know your platform but you might have some luck compiling a debugging malloc library that gives you some stats. http://www-128.ibm.com/developerworks/linux/library/l-debug/ describes a couple - the MEMWATCH or YAMD tools might do what you want. There might be some utility in building sqlite on a Linux box with the above libraries. You could put a thin wrapper around calls to malloc, run some queries and dump the stats to a file for analysis. Martin