Changeset: 180109775565 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=180109775565
Modified Files:
        clients/Tests/MAL-signatures.stable.out
        clients/Tests/MAL-signatures.stable.out.int128
        clients/Tests/exports.stable.out
        gdk/gdk_utils.c
Branch: wlcr
Log Message:

merge default


diffs (96 lines):

diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -7761,7 +7761,7 @@ Ready.
 [ "io",        "printf",       "pattern io.printf(fmt:str, val:any...):void ", 
"IOprintf;",    "Select default format "        ]
 [ "io",        "printf",       "pattern io.printf(filep:streams, fmt:str):void 
",      "IOprintfStream;",      "Select default format "        ]
 [ "io",        "printf",       "pattern io.printf(filep:streams, fmt:str, 
val:any...):void ",  "IOprintfStream;",      "Select default format "        ]
-[ "io",        "setmemorylimit",       "command 
io.setmemorylimit(nbytes:lng):void ",  "IOsetmemorylimit;",    "Set memory 
limit for testing"  ]
+[ "io",        "setmallocsuccesscount",        "command 
io.setmallocsuccesscount(count:lng):void ",    "IOsetmallocsuccesscount;",     
"Set number of mallocs that are allowed to succeed."    ]
 [ "io",        "stderr",       "pattern io.stderr():streams ", "io_stderr;",   
"return the error stream for the database console"      ]
 [ "io",        "stdin",        "pattern io.stdin():bstream ",  "io_stdin;",    
"return the input stream to the database client"        ]
 [ "io",        "stdout",       "pattern io.stdout():streams ", "io_stdout;",   
"return the output stream for the database client"      ]
diff --git a/clients/Tests/MAL-signatures.stable.out.int128 
b/clients/Tests/MAL-signatures.stable.out.int128
--- a/clients/Tests/MAL-signatures.stable.out.int128
+++ b/clients/Tests/MAL-signatures.stable.out.int128
@@ -10117,7 +10117,7 @@ Ready.
 [ "io",        "printf",       "pattern io.printf(fmt:str, val:any...):void ", 
"IOprintf;",    "Select default format "        ]
 [ "io",        "printf",       "pattern io.printf(filep:streams, fmt:str):void 
",      "IOprintfStream;",      "Select default format "        ]
 [ "io",        "printf",       "pattern io.printf(filep:streams, fmt:str, 
val:any...):void ",  "IOprintfStream;",      "Select default format "        ]
-[ "io",        "setmemorylimit",       "command 
io.setmemorylimit(nbytes:lng):void ",  "IOsetmemorylimit;",    "Set memory 
limit for testing"  ]
+[ "io",        "setmallocsuccesscount",        "command 
io.setmallocsuccesscount(count:lng):void ",    "IOsetmallocsuccesscount;",     
"Set number of mallocs that are allowed to succeed."    ]
 [ "io",        "stderr",       "pattern io.stderr():streams ", "io_stderr;",   
"return the error stream for the database console"      ]
 [ "io",        "stdin",        "pattern io.stdin():bstream ",  "io_stdin;",    
"return the input stream to the database client"        ]
 [ "io",        "stdout",       "pattern io.stdout():streams ", "io_stdout;",   
"return the output stream for the database client"      ]
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
@@ -268,7 +268,7 @@ gdk_return GDKreleasemmap(void *ptr, siz
 gdk_return GDKreleasesem(int sem_id, str *msg);
 void GDKreset(int status, int exit);
 void GDKsetenv(str name, str value);
-void GDKsetmemorylimit(lng nbytes);
+void GDKsetmallocsuccesscount(lng count);
 ssize_t GDKstrFromStr(unsigned char *dst, const unsigned char *src, ssize_t 
len);
 str GDKstrdup(const char *s) __attribute__((__warn_unused_result__));
 str GDKstrndup(const char *s, size_t n) 
__attribute__((__warn_unused_result__));
@@ -1206,7 +1206,7 @@ str IOimport(void *ret, bat *bid, str *f
 str IOprint_val(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
 str IOprintf(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
 str IOprintfStream(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
-str IOsetmemorylimit(void *res, lng *nbytes);
+str IOsetmallocsuccesscount(void *res, lng *nbytes);
 str IOtable(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
 str ITRbunIterator(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
 str ITRbunNext(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -451,6 +451,10 @@ MT_init(void)
 static void THRinit(void);
 static void GDKlockHome(void);
 
+#ifndef NDEBUG
+static MT_Lock mallocsuccesslock MT_LOCK_INITIALIZER("mallocsuccesslock");
+#endif
+
 int
 GDKinit(opt *set, int setlen)
 {
@@ -481,6 +485,9 @@ GDKinit(opt *set, int setlen)
        MT_lock_init(&GDKnameLock, "GDKnameLock");
        MT_lock_init(&GDKthreadLock, "GDKthreadLock");
        MT_lock_init(&GDKtmLock, "GDKtmLock");
+#ifndef NDEBUG
+       MT_lock_init(&mallocsuccesslock, "mallocsuccesslock");
+#endif
 #endif
        for (i = 0; i <= BBP_BATMASK; i++) {
                MT_lock_init(&GDKbatLock[i].swap, "GDKswapLock");
@@ -1639,16 +1646,11 @@ GDKmalloc_prefixsize(size_t size)
        return s;
 }
 
-#ifndef NDEBUG
-static MT_Lock mallocsuccesslock;
-#endif
-
 void
 GDKsetmallocsuccesscount(lng count)
 {
        (void) count;
 #ifndef NDEBUG
-       MT_lock_init(&mallocsuccesslock, "mallocsuccesslock");
        GDK_malloc_success_count = count;
 #endif
 }
@@ -1675,7 +1677,8 @@ GDKmallocmax(size_t size, size_t *maxsiz
        /* fail malloc for testing purposes depending on set limit */
        if (GDK_malloc_success_count > 0) {
                MT_lock_set(&mallocsuccesslock);
-               if (GDK_malloc_success_count > 0) GDK_malloc_success_count--;
+               if (GDK_malloc_success_count > 0)
+                       GDK_malloc_success_count--;
                MT_lock_unset(&mallocsuccesslock);
        }
        if (GDK_malloc_success_count == 0) {
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to