Changeset: b5f2b17c6a1b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b5f2b17c6a1b
Modified Files:
        gdk/gdk_posix.c
        gdk/gdk_utils.c
        monetdb5/modules/kernel/status.c
Branch: Feb2013
Log Message:

Get rid of all uses of sbrk().
sbrk() returns the top of the system heap, but that is a useless
concept in the age of large address spaces and memory maps (also from
malloc) all over the place.  Plus, it's not in the latest Posix.


diffs (74 lines):

diff --git a/gdk/gdk_posix.c b/gdk/gdk_posix.c
--- a/gdk/gdk_posix.c
+++ b/gdk/gdk_posix.c
@@ -34,10 +34,6 @@
 #include <unistd.h>            /* sbrk on Solaris */
 #include <string.h>     /* strncpy */
 
-#ifdef __hpux
-extern char *sbrk(int);
-#endif
-
 #ifdef HAVE_FCNTL_H
 # include <fcntl.h>
 #endif
@@ -277,7 +273,7 @@ char *MT_heapbase = NULL;
 void
 MT_init_posix(void)
 {
-       MT_heapbase = (char *) sbrk(0);
+       MT_heapbase = 0;
 }
 
 /* return RSS in bytes */
@@ -362,7 +358,7 @@ MT_getrss(void)
 char *
 MT_heapcur(void)
 {
-       return (char *) sbrk(0);
+       return 0;
 }
 
 void *
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -438,10 +438,7 @@ MT_init(void)
 size_t
 GDKmem_cursize(void)
 {
-       /* RAM/swapmem that Monet has claimed from OS */
-       size_t heapsize = MT_heapcur() - MT_heapbase;
-
-       return (size_t) SEG_SIZE(heapsize, MT_VMUNITLOG);
+       return GDKmem_inuse();
 }
 
 size_t
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
@@ -206,7 +206,7 @@ SYScpuStatistics(int *ret, int *ret2)
        return MAL_SUCCEED;
 }
 
-static char *memincr = NULL;
+static size_t memincr;
 str
 SYSmemStatistics(int *ret, int *ret2)
 {
@@ -227,12 +227,8 @@ SYSmemStatistics(int *ret, int *ret2)
        BATseqbase(bn,0);
 
        /* store counters, ignore errors */
-       if (memincr == NULL)
-               memincr = MT_heapbase;
-
-       i = (wrd) (MT_heapcur() - memincr);
-
-       memincr = MT_heapcur();
+       i = (wrd) (GDKmem_inuse() - memincr);
+       memincr = GDKmem_inuse();
        bn = BUNappend(bn, "memincr", FALSE);
        b = BUNappend(b, &i, FALSE);
        i = (wrd) m.arena;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to