Changeset: 3108596d8d5d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3108596d8d5d
Modified Files:
clients/Tests/exports.stable.out
configure.ag
gdk/gdk_posix.c
gdk/gdk_posix.h
gdk/gdk_utils.c
monetdb5/mal/mal_profiler.c
monetdb5/mal/mal_profiler.h
monetdb5/modules/kernel/status.c
monetdb5/scheduler/run_pipeline.h
Branch: default
Log Message:
Removed use of mallinfo() library function.
It's pretty useless on a 64 bit system, so we already didn't actually
use it.
diffs (294 lines):
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -298,7 +298,6 @@ size_t MT_getrss(void);
void MT_init(void);
int MT_join_thread(MT_Id t);
int MT_lockf(char *filename, int mode, off_t off, off_t len);
-struct Mallinfo MT_mallinfo(void);
void *MT_mmap(const char *path, int mode, size_t len);
int MT_munmap(void *p, size_t len);
int MT_path_absolute(const char *path);
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -1505,17 +1505,6 @@ KVM_LIBS=""
AC_CHECK_LIB([kvm], [kvm_open], [KVM_LIBS="-lkvm" ] )
AC_SUBST([KVM_LIBS])
-save_LIBS="$LIBS"
-LIBS="$LIBS $MALLOC_LIBS"
-AC_CHECK_FUNCS([mallopt])
-AC_CHECK_FUNC([mallinfo],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([[@%:@include <malloc.h>]],
- [[struct mallinfo m;int
x[1+sizeof(m.usmblks)-sizeof(void *)]]])],
- [AC_DEFINE([HAVE_USEFUL_MALLINFO], 1,
- [Define if you have mallinfo])])])
-LIBS="$save_LIBS"
-
# libpthread
org_have_pthread=auto
have_pthread=$org_have_pthread
diff --git a/gdk/gdk_posix.c b/gdk/gdk_posix.c
--- a/gdk/gdk_posix.c
+++ b/gdk/gdk_posix.c
@@ -691,31 +691,6 @@ MT_msync(void *p, size_t len)
return ret;
}
-struct Mallinfo
-MT_mallinfo(void)
-{
- struct Mallinfo _ret;
-
-#ifdef HAVE_USEFUL_MALLINFO
- struct mallinfo m;
-
- m = mallinfo();
- _ret.arena = m.arena;
- _ret.ordblks = m.ordblks;
- _ret.smblks = m.smblks;
- _ret.hblks = m.hblks;
- _ret.hblkhd = m.hblkhd;
- _ret.usmblks = m.usmblks;
- _ret.fsmblks = m.fsmblks;
- _ret.uordblks = m.uordblks;
- _ret.fordblks = m.fordblks;
- _ret.keepcost = m.keepcost;
-#else
- memset(&_ret, 0, sizeof(_ret));
-#endif
- return _ret;
-}
-
int
MT_path_absolute(const char *pathname)
{
@@ -925,42 +900,6 @@ MT_msync(void *p, size_t len)
#define _HEAPBADPTR (-6)
#endif
-struct Mallinfo
-MT_mallinfo(void)
-{
- struct Mallinfo _ret;
- _HEAPINFO hinfo;
- int heapstatus;
-
- hinfo._pentry = NULL;
- memset(&_ret, 0, sizeof(_ret));
-
- while ((heapstatus = _heapwalk(&hinfo)) == _HEAPOK) {
- _ret.arena += hinfo._size;
- if (hinfo._size > MT_SMALLBLOCK) {
- _ret.smblks++;
- if (hinfo._useflag == _USEDENTRY) {
- _ret.usmblks += hinfo._size;
- } else {
- _ret.fsmblks += hinfo._size;
- }
- } else {
- _ret.ordblks++;
- if (hinfo._useflag == _USEDENTRY) {
- _ret.uordblks += hinfo._size;
- } else {
- _ret.fordblks += hinfo._size;
- }
- }
- }
- if (heapstatus == _HEAPBADPTR || heapstatus == _HEAPBADBEGIN ||
heapstatus == _HEAPBADNODE) {
-
- fprintf(stderr, "#mallinfo(): heap is corrupt.");
- }
- _heapmin();
- return _ret;
-}
-
int
MT_path_absolute(const char *pathname)
{
diff --git a/gdk/gdk_posix.h b/gdk/gdk_posix.h
--- a/gdk/gdk_posix.h
+++ b/gdk/gdk_posix.h
@@ -12,7 +12,7 @@
#include <sys/types.h>
#ifdef HAVE_MALLOC_H
-# include <malloc.h> /* mallopt, mallinfo, and malloc, free etc. */
+# include <malloc.h>
#endif
#ifdef HAVE_FTIME
@@ -64,22 +64,6 @@
/* until another allocation */
#endif
-/* our version of struct mallinfo */
-struct Mallinfo {
- size_t arena; /* total space in arena */
- size_t ordblks; /* number of ordinary blocks */
- size_t smblks; /* number of small blocks */
- size_t hblks; /* number of holding blocks */
- size_t hblkhd; /* space in holding block headers */
- size_t usmblks; /* space in small blocks in use */
- size_t fsmblks; /* space in free small blocks */
- size_t uordblks; /* space in ordinary blocks in use */
- size_t fordblks; /* space in free ordinary blocks */
- size_t keepcost; /* cost of enabling keep option */
-};
-
-gdk_export struct Mallinfo MT_mallinfo(void);
-
/*
* @- locking, sleep
*/
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -1525,20 +1525,6 @@ GDKvm_cursize(void)
static void
GDKmemdump(void)
{
- struct Mallinfo m = MT_mallinfo();
-
- MEMDEBUG {
- fprintf(stderr, "\n");
- fprintf(stderr, "#mallinfo.arena = " SZFMT "\n", m.arena);
- fprintf(stderr, "#mallinfo.ordblks = " SZFMT "\n", m.ordblks);
- fprintf(stderr, "#mallinfo.smblks = " SZFMT "\n", m.smblks);
- fprintf(stderr, "#mallinfo.hblkhd = " SZFMT "\n", m.hblkhd);
- fprintf(stderr, "#mallinfo.hblks = " SZFMT "\n", m.hblks);
- fprintf(stderr, "#mallinfo.usmblks = " SZFMT "\n", m.usmblks);
- fprintf(stderr, "#mallinfo.fsmblks = " SZFMT "\n", m.fsmblks);
- fprintf(stderr, "#mallinfo.uordblks = " SZFMT "\n", m.uordblks);
- fprintf(stderr, "#mallinfo.fordblks = " SZFMT "\n", m.fordblks);
- }
#ifdef GDK_MEM_KEEPHISTO
{
int i;
diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c
--- a/monetdb5/mal/mal_profiler.c
+++ b/monetdb5/mal/mal_profiler.c
@@ -797,7 +797,6 @@ cleanupTraces(void)
void
cachedProfilerEvent(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
{
- /* static struct Mallinfo prevMalloc; */
char buf[BUFSIZ]= {0};
int tid = (int)THRgettid();
lng v1 = 0, v2= 0, v3=0, v4=0, v5=0;
@@ -806,10 +805,8 @@ cachedProfilerEvent(MalBlkPtr mb, MalStk
lng rssMB = MT_getrss()/1024/1024;
lng tmpspace = pci->wbytes/1024/1024;
int errors = 0;
- /* struct Mallinfo infoMalloc; */
clock = GDKusec();
- /* infoMalloc = MT_mallinfo(); */
#ifdef HAVE_SYS_RESOURCE_H
getrusage(RUSAGE_SELF, &infoUsage);
#endif
diff --git a/monetdb5/mal/mal_profiler.h b/monetdb5/mal/mal_profiler.h
--- a/monetdb5/mal/mal_profiler.h
+++ b/monetdb5/mal/mal_profiler.h
@@ -21,7 +21,6 @@ typedef struct rusage Rusage;
#endif
typedef struct tms Tms;
-typedef struct Mallinfo Mallinfo;
mal_export int malProfileMode;
diff --git a/monetdb5/modules/kernel/status.c b/monetdb5/modules/kernel/status.c
--- a/monetdb5/modules/kernel/status.c
+++ b/monetdb5/modules/kernel/status.c
@@ -208,12 +208,9 @@ static size_t memincr;
str
SYSmemStatistics(bat *ret, bat *ret2)
{
- struct Mallinfo m;
BAT *b, *bn;
lng i;
- m = MT_mallinfo();
-
bn = COLnew(0,TYPE_str, 32, TRANSIENT);
b = COLnew(0, TYPE_lng, 32, TRANSIENT);
if (b == 0 || bn == 0) {
@@ -228,42 +225,6 @@ SYSmemStatistics(bat *ret, bat *ret2)
if (BUNappend(bn, "memincr", FALSE) != GDK_SUCCEED ||
BUNappend(b, &i, FALSE) != GDK_SUCCEED)
goto bailout;
- i = (lng) m.arena;
- if (BUNappend(bn, "arena", FALSE) != GDK_SUCCEED ||
- BUNappend(b, &i, FALSE) != GDK_SUCCEED)
- goto bailout;
- i = (lng) m.ordblks;
- if (BUNappend(bn, "ordblks", FALSE) != GDK_SUCCEED ||
- BUNappend(b, &i, FALSE) != GDK_SUCCEED)
- goto bailout;
- i = (lng) m.smblks;
- if (BUNappend(bn, "smblks", FALSE) != GDK_SUCCEED ||
- BUNappend(b, &i, FALSE) != GDK_SUCCEED)
- goto bailout;
- i = (lng) m.hblkhd;
- if (BUNappend(bn, "hblkhd", FALSE) != GDK_SUCCEED ||
- BUNappend(b, &i, FALSE) != GDK_SUCCEED)
- goto bailout;
- i = (lng) m.hblks;
- if (BUNappend(bn, "hblks", FALSE) != GDK_SUCCEED ||
- BUNappend(b, &i, FALSE) != GDK_SUCCEED)
- goto bailout;
- i = (lng) m.usmblks;
- if (BUNappend(bn, "usmblks", FALSE) != GDK_SUCCEED ||
- BUNappend(b, &i, FALSE) != GDK_SUCCEED)
- goto bailout;
- i = (lng) m.fsmblks;
- if (BUNappend(bn, "fsmblks", FALSE) != GDK_SUCCEED ||
- BUNappend(b, &i, FALSE) != GDK_SUCCEED)
- goto bailout;
- i = (lng) m.uordblks;
- if (BUNappend(bn, "uordblks", FALSE) != GDK_SUCCEED ||
- BUNappend(b, &i, FALSE) != GDK_SUCCEED)
- goto bailout;
- i = (lng) m.fordblks;
- if (BUNappend(bn, "fordblks", FALSE) != GDK_SUCCEED ||
- BUNappend(b, &i, FALSE) != GDK_SUCCEED)
- goto bailout;
if (pseudo(ret,ret2,bn,b))
goto bailout;
return MAL_SUCCEED;
@@ -302,7 +263,6 @@ SYSmem_usage(bat *ret, bat *ret2, const
lng hbuns = 0, tbuns = 0, hhsh = 0, thsh = 0, hind = 0, tind = 0, head
= 0, tail = 0, tot = 0, n = 0, sz;
BAT *bn = COLnew(0, TYPE_str, 2 * getBBPsize(), TRANSIENT);
BAT *b = COLnew(0, TYPE_lng, 2 * getBBPsize(), TRANSIENT);
- struct Mallinfo m;
char buf[1024];
bat i;
@@ -377,13 +337,6 @@ SYSmem_usage(bat *ret, bat *ret2, const
/* now look at what the global statistics report (to see if it
coincides) */
- /* how much *used* bytes in heap? */
- m = MT_mallinfo();
- sz = (size_t) m.usmblks + (size_t) m.uordblks + (size_t) m.hblkhd;
- if (BUNappend(bn, "_tot/malloc", FALSE) != GDK_SUCCEED ||
- BUNappend(b, &sz, FALSE) != GDK_SUCCEED)
- goto bailout;
-
/* measure actual heap size, includes wasted fragmented space and anon
mmap space used by malloc() */
sz = GDKmem_cursize();
if (BUNappend(bn, "_tot/heap", FALSE) != GDK_SUCCEED ||
diff --git a/monetdb5/scheduler/run_pipeline.h
b/monetdb5/scheduler/run_pipeline.h
--- a/monetdb5/scheduler/run_pipeline.h
+++ b/monetdb5/scheduler/run_pipeline.h
@@ -23,7 +23,6 @@
#endif
struct {
- /*mallinfo memory; */
/* rusage memused; */
int cpuload; /* hard to get */
} runtime;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list