SQLite Forum

Understanding memory allocation behavior of SQLite
Note that this does not answer your question(s) directly.  However, minimizing the amount of "work" being done also reduces the number of calls to malloc/free, and addressing the "root cause" will be more efficient in the long run (that is, if it takes you 20 minutes to shovel the snow out of the driveway, then having the shovel "empty faster" is not likely to make much difference.  However, moving from Edmonton to Miami will speed up the process.)