Remove ifdef EXITFREE i.e. build as if it was always defined

9 views
Skip to first unread message

Dominique Pellé

unread,
Mar 11, 2022, 3:20:16 AM3/11/22
to vim_dev
Hi all

Should we consider removing -DEXITFREE i.e. always freeing
memory when exiting without ifdef? I would prefer removing it.

Pros:
* the fewer ifdef the better (fewer configurations to test)
* simpler for users/developers to check for leaks, for those
we do not bother rebuilding Vim with -DEXITREE.
* we can slightly simplify src/Makefile, runtime/doc/debug.txt
and code which uses ifdef EXITFREE
* more chances to find memory errors when exiting and thus
report and fix them. There are no know such bugs at the
moment but maybe some exotic platforms or configurations
have bugs which we're not aware of as most users do not
rebuild with -DEXITFREE

Cons:
* slightly bigger vim, but the difference is insignificant
(+0.23% bigger .text section according to my measurement
on Linux). See sizes of Vim tiny with/without -DEXITFREE:

```
$ size vim-tiy-WITHOUT-DEXITFREE vim-tiny-WITH-DEXITFREE
text data bss dec hex filename
1680633 147704 26056 1854393 1c4bb9 vim-tiy-WITHOUT-EXITFREE
1684654 147712 26056 1858422 1c5b76 vim-tiny-WITH-EXITFREE
```
* bigger risk of crashing when exiting if there is a memory error

Regards
Dominique

Bram Moolenaar

unread,
Mar 11, 2022, 7:07:02 AM3/11/22
to vim...@googlegroups.com, Dominique Pellé
There is only a tiny risk of crashing on exit. And it happens when all
files have been written, thus it can't cause trouble.

It's a small advantage to remove some #ifdefs (I count 47), with a small
penalty of some more code. I can't think of a bigger advantage or
disadvantage.

--
hundred-and-one symptoms of being an internet addict:
228. You spend Saturday night making the counter on your home page
pass that 2000 mark.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages