1curs_memleaks(3X) curs_memleaks(3X)
2
3
4
6 _nc_freeall, _nc_free_and_exit, _nc_free_tinfo - curses memory-leak
7 checking
8
10 #include <curses.h>
11
12 void exit_curses(int);
13 void exit_terminfo(int);
14
15 /* deprecated */
16 void _nc_freeall(void);
17 void _nc_free_and_exit(int);
18 void _nc_free_tinfo(int);
19
21 These functions are used to simplify analysis of memory leaks in the
22 ncurses library.
23
24 Any implementation of curses must not free the memory associated with a
25 screen, since (even after calling endwin), it must be available for use
26 in the next call to refresh(3X). There are also chunks of memory held
27 for performance reasons. That makes it hard to analyze curses applica‐
28 tions for memory leaks. When using the specially configured debugging
29 version of the ncurses library, applications can call functions which
30 free those chunks of memory, simplifying the process of memory-leak
31 checking.
32
33 Some of the functions are named with a “_nc_” prefix because they are
34 not intended for use in the non-debugging library:
35
36 _nc_freeall
37 This frees (almost) all of the memory allocated by ncurses.
38
39 _nc_free_and_exit
40 This frees the memory allocated by ncurses (like _nc_freeall), and
41 exits the program. It is preferred over _nc_freeall since some of
42 that memory may be required to keep the application running. Sim‐
43 ply exiting (with the given exit-code) is safer.
44
45 _nc_free_tinfo
46 Use this function if only the low-level terminfo functions (and
47 corresponding library) are used. Like _nc_free_and_exit, it exits
48 the program after freeing memory.
49
50 The functions prefixed “_nc” are normally not available; they must be
51 configured into the library at build time using the --disable-leaks op‐
52 tion. That compiles-in code that frees memory that normally would not
53 be freed.
54
55 The exit_curses and exit_terminfo functions call _nc_free_and_exit and
56 _nc_free_tinfo if the library is configured to support memory-leak
57 checking. If the library is not configured to support memory-leak
58 checking, they simply call exit.
59
61 These functions do not return a value.
62
64 These functions are not part of X/Open Curses; nor do other implementa‐
65 tions of curses provide a similar feature.
66
68 curses(3X).
69
70
71
72 curs_memleaks(3X)