kOverwrite vs kWriteDelete parameters


I wrote some class A : public TObject and write it in the TFile using Write method. First time it was like A->Write(cname). Next time I read object from the file and write it back using additional parameters kOverwrite or kWriteDelete. In the manual it was written that the second option is more safety. But I found that when kWriteDelete parameter was used the size of file is sligtly incresed and it is not changed when kOverwrite was used.
During the test class A was not changed between read and write operations.
1,842,414 initial size
1,860,796 after 1st rewrite
1,879,178 after 2nd rewrite

I plan rewrite own class many times and safety is significant to me but the increasing of file size on each rewrite operation does not allow using of safety option.

Is this increasing of file size with kWriteDelete option normal?

Thanks in advance,
Andrey Daniel

This increase in size is normal because we have to keep on the file the old and new version before deleting the old version. When the old version is deleted, a gap is created. This gap may be reused by a new Write operation if the size of the object is smaller than the gap.
You better close your file and reopen it again after each transaction to recupetate the gap asap.