SQLite Forum

Inconsistent memory stats of sqlite3 with different compilers
Login
Hi there,

I found that `sqlite3 -stats` compiled with `gcc11` and `clang12` would emit different memory stats on some crafted inputs.

- SQLite version: `3.36.0`

- Compiler args:  `-DSQLITE_MAX_LENGTH=128000000 \
               -DSQLITE_MAX_SQL_LENGTH=128000000 \
               -DSQLITE_MAX_MEMORY=25000000 \
               -DSQLITE_PRINTF_PRECISION_LIMIT=1048576 \
               -DSQLITE_DEBUG=1 \
               -DSQLITE_MAX_PAGE_COUNT=16384`
(I used these args for avoiding creating large databases and irrelevant OOMs)

- Compilers: `gcc11` and `clang12`

- Reproduce:  run  the following command with different compilers compiled
binaries. Then compare the two `stats.txt`. ```sqlite3 -stats < diff.sql | xargs -i echo {} > stats.txt``` 

You can download `diff.sql` from this link: [diff.sql](https://drive.google.com/file/d/1Qa5dLtgwTQkF5qHXakObe_8qM6lbeGgn/view?usp=sharing)