memory leak fixed
This commit is contained in:
parent
f5702f2c75
commit
27ed270851
1
NEWS
1
NEWS
@ -1,5 +1,6 @@
|
|||||||
procps-3.1.5 --> procps-3.1.6
|
procps-3.1.5 --> procps-3.1.6
|
||||||
|
|
||||||
|
top: memory leak fixed
|
||||||
ps: new --ppid option selects by PPID
|
ps: new --ppid option selects by PPID
|
||||||
watch: new --no-title option
|
watch: new --no-title option
|
||||||
handle SPARC Linux badness
|
handle SPARC Linux badness
|
||||||
|
@ -34,8 +34,12 @@
|
|||||||
#define STRTOUKL strtoul
|
#define STRTOUKL strtoul
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// since gcc-2.5
|
||||||
|
#define NORETURN __attribute__((__noreturn__))
|
||||||
|
#define FUNCTION __attribute__((__const__)) // no access to global mem, even via ptr, and no side effect
|
||||||
|
|
||||||
#if !defined(restrict) && __STDC_VERSION__ < 199901
|
#if !defined(restrict) && __STDC_VERSION__ < 199901
|
||||||
#if __GNUC__ > 2 || __GNUC_MINOR__ >= 92 // maybe 92 or 95 ?
|
#if __GNUC__ > 2 || __GNUC_MINOR__ >= 92
|
||||||
#define restrict __restrict__
|
#define restrict __restrict__
|
||||||
#else
|
#else
|
||||||
#warning No restrict keyword?
|
#warning No restrict keyword?
|
||||||
@ -43,35 +47,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// marks old junk, to warn non-procps library users
|
|
||||||
#if ( __GNUC__ == 3 && __GNUC_MINOR__ > 0 ) || __GNUC__ > 3
|
|
||||||
#define OBSOLETE __attribute__((deprecated))
|
|
||||||
#else
|
|
||||||
#define OBSOLETE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Tells gcc that function is library-internal;
|
|
||||||
// so no need to do dynamic linking at run-time.
|
|
||||||
// This might work with slightly older compilers too.
|
|
||||||
#if ( __GNUC__ == 3 && __GNUC_MINOR__ > 1 ) || __GNUC__ > 3
|
|
||||||
#define HIDDEN __attribute__((visibility("hidden")))
|
|
||||||
#else
|
|
||||||
#define HIDDEN
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Like HIDDEN, but for an alias that gets created.
|
|
||||||
// In gcc-3.2 there is an alias+hidden conflict.
|
|
||||||
// Many will have patched this bug, but oh well.
|
|
||||||
#if ( __GNUC__ == 3 && __GNUC_MINOR__ > 2 ) || __GNUC__ > 3
|
|
||||||
#define HIDDEN_ALIAS(x) extern __typeof(x) x##_direct __attribute__((alias(#x),visibility("hidden")))
|
|
||||||
#else
|
|
||||||
#define HIDDEN_ALIAS(x) extern __typeof(x) x##_direct __attribute__((alias(#x)))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// since gcc-2.5
|
|
||||||
#define NORETURN __attribute__((__noreturn__))
|
|
||||||
#define FUNCTION __attribute__((__const__)) // no access to global mem, even via ptr, and no side effect
|
|
||||||
|
|
||||||
#if __GNUC__ > 2 || __GNUC_MINOR__ >= 96
|
#if __GNUC__ > 2 || __GNUC_MINOR__ >= 96
|
||||||
// won't alias anything, and aligned enough for anything
|
// won't alias anything, and aligned enough for anything
|
||||||
#define MALLOC __attribute__ ((__malloc__))
|
#define MALLOC __attribute__ ((__malloc__))
|
||||||
@ -89,4 +64,32 @@
|
|||||||
#define expected(x,y) (x)
|
#define expected(x,y) (x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// marks old junk, to warn non-procps library users
|
||||||
|
#if ( __GNUC__ == 3 && __GNUC_MINOR__ > 0 ) || __GNUC__ > 3
|
||||||
|
#define OBSOLETE __attribute__((deprecated))
|
||||||
|
#else
|
||||||
|
#define OBSOLETE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ( __GNUC__ == 3 && __GNUC_MINOR__ > 1 ) || __GNUC__ > 3
|
||||||
|
// Tells gcc that function is library-internal;
|
||||||
|
// so no need to do dynamic linking at run-time.
|
||||||
|
// This might work with slightly older compilers too.
|
||||||
|
#define HIDDEN __attribute__((visibility("hidden")))
|
||||||
|
// Tell g++ that a function won't throw exceptions.
|
||||||
|
#define NOTHROW __attribute__((__nothrow__))
|
||||||
|
#else
|
||||||
|
#define HIDDEN
|
||||||
|
#define NOTHROW
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Like HIDDEN, but for an alias that gets created.
|
||||||
|
// In gcc-3.2 there is an alias+hidden conflict.
|
||||||
|
// Many will have patched this bug, but oh well.
|
||||||
|
#if ( __GNUC__ == 3 && __GNUC_MINOR__ > 2 ) || __GNUC__ > 3
|
||||||
|
#define HIDDEN_ALIAS(x) extern __typeof(x) x##_direct __attribute__((alias(#x),visibility("hidden")))
|
||||||
|
#else
|
||||||
|
#define HIDDEN_ALIAS(x) extern __typeof(x) x##_direct __attribute__((alias(#x)))
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -212,7 +212,6 @@ extern void freeproc(proc_t* p);
|
|||||||
#define PROC_FILLWCHAN 0x0080 /* look up WCHAN name */
|
#define PROC_FILLWCHAN 0x0080 /* look up WCHAN name */
|
||||||
#define PROC_FILLARG 0x0100 /* alloc and fill in `cmdline' */
|
#define PROC_FILLARG 0x0100 /* alloc and fill in `cmdline' */
|
||||||
|
|
||||||
#define PROC_FILLBUG 0x0fff /* No idea what we need */
|
|
||||||
#define PROC_FILLANY 0x0000 /* either stat or status will do */
|
#define PROC_FILLANY 0x0000 /* either stat or status will do */
|
||||||
|
|
||||||
/* Obsolete, consider only processes with one of the passed: */
|
/* Obsolete, consider only processes with one of the passed: */
|
||||||
|
7
top.c
7
top.c
@ -1021,7 +1021,7 @@ static proc_t **procs_refresh (proc_t **table, int flags)
|
|||||||
|
|
||||||
prochlp(NULL); // prep for a new frame
|
prochlp(NULL); // prep for a new frame
|
||||||
if (Monpidsidx)
|
if (Monpidsidx)
|
||||||
PT = openproc(PROC_FILLBUG | PROC_PID, Monpids);
|
PT = openproc(flags, Monpids);
|
||||||
else
|
else
|
||||||
PT = openproc(flags);
|
PT = openproc(flags);
|
||||||
|
|
||||||
@ -2096,6 +2096,7 @@ static void reframewins (void)
|
|||||||
if (!(Frames_libflags & L_stat)) Frames_libflags |= L_status;
|
if (!(Frames_libflags & L_stat)) Frames_libflags |= L_status;
|
||||||
}
|
}
|
||||||
if (!Frames_libflags) Frames_libflags = L_DEFAULT;
|
if (!Frames_libflags) Frames_libflags = L_DEFAULT;
|
||||||
|
if (selection_type=='p') Frames_libflags |= PROC_PID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2801,7 +2802,7 @@ static proc_t **summary_show (void)
|
|||||||
|
|
||||||
// whoa first time, gotta' prime the pump...
|
// whoa first time, gotta' prime the pump...
|
||||||
if (!p_table) {
|
if (!p_table) {
|
||||||
p_table = procs_refresh(NULL, L_DEFAULT);
|
p_table = procs_refresh(NULL, Frames_libflags);
|
||||||
putp(Cap_clr_scr);
|
putp(Cap_clr_scr);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
} else
|
} else
|
||||||
@ -3141,7 +3142,7 @@ static void frame_make (void)
|
|||||||
proc_t **ppt;
|
proc_t **ppt;
|
||||||
int i, scrlins;
|
int i, scrlins;
|
||||||
|
|
||||||
/* note: except for PROC_PID, all libproc flags are managed by
|
/* note: all libproc flags are managed by
|
||||||
reframewins(), who also builds each window's column headers */
|
reframewins(), who also builds each window's column headers */
|
||||||
if (!Frames_libflags) {
|
if (!Frames_libflags) {
|
||||||
reframewins();
|
reframewins();
|
||||||
|
Loading…
Reference in New Issue
Block a user