This mainly comes from the increase of the .debug$S section. The reason is that when PDB is used, not everything about debug is put into the pdb, the debug symbols are still kept in the .debug$S section in theh object/lib file. What is put into pdb at least contains type information, this is the reason that .debug$T become very small when /Zi or /ZI is used, i.e. it only contains pointer to pdb file in those cases.
You can use
dumpbin.exe your_lib.lib
to show the result.
For a large lib the size can increase from 4MB to 20MB.
For a very simple lib:
no debug:
4 .bss
60 .chks64
138 .debug$S
D2 .drectve
18 .pdata
8 .rtc$IMZ
8 .rtc$TMZ
2C .text$mn
10 .xdata
/Zi:
4 .bss
98 .chks64
848 .debug$S
E0 .debug$T
113 .drectve
4 .msvcjmc
18 .pdata
8 .rtc$IMZ
8 .rtc$TMZ
76 .text$mn
10 .xdata
/ZI:
4 .bss
C0 .chks64
1454 .debug$S
E0 .debug$T
135 .drectve
4 .msvcjmc
18 .pdata
8 .rtc$IMZ
8 .rtc$TMZ
89 .text$mn
20 .xdata
/Z7: Debug info embed into .debug$P section now, and the .debug$S also shrink a little.
4 .bss
98 .chks64
1210 .debug$P
848 .debug$S
78C .debug$T
113 .drectve
4 .msvcjmc
18 .pdata
8 .rtc$IMZ
8 .rtc$TMZ
76 .text$mn
10 .xdata