Purged almost documents in CBL iOS the disk space is not reduce but also increase

Hi all,

I define a function for purging older data, I use CBL 1.4.1
I have tried purged 9800/21000 documents but the disk space show on iPad Setting increased. (from 294MB to 375MB). What happen?.
I have try get the document from iPad and seen the size of db.sqlite3(294MB) + db.sqlite3-wal(80MB) ~= size of whole document app(375MB). I try connect to this database file. All purged documents have removed out in database (docs and revs table). Why the disk space is not reduce? Any wrong?
I also try purged almost documents but disk space is not reduce.
my code:
[database inTransaction:^BOOL{ for (int i = 0; i< docs.count ; i++) { CBLDocument *doc = docs[i]; NSLog(@"P %d / %d", i, docs.count); if ([doc purgeDocument:nil]) { NSLog(@"PurgeS %@", doc.documentID); } else { NSLog(@"PurgeF %@", doc.documentID); } } return YES; }]

Any idea or explanation in this case.
Thanks

I have tried [database compact:&error];
The db.sqlite3 actual reduce to 143MB. but the db.sqlite3-wal increase to 144MB.
Can we empty db.sqlite3-wal? how?

Hm. Does the WAL shrink when the database is closed?

Thank Jens.
I also close app but it still.

Look the -WAL file was saved the last transaction(I have purged many documents in a transaction).
So I add one more transaction by updating a document after call compact function. The -WAL file was shrink(~0MB).