Changeset: 62d6f34366fe for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/62d6f34366fe
Modified Files:
clients/Tests/MAL-signatures-hge.test
clients/Tests/MAL-signatures.test
clients/Tests/exports.stable.out
gdk/gdk_utils.c
gdk/gdk_utils.h
monetdb5/mal/mal_exception.c
monetdb5/modules/mal/mal_io.c
Branch: Aug2024
Log Message:
Removed unused test code GDKsetmallocsuccesscount.
diffs (157 lines):
diff --git a/clients/Tests/MAL-signatures-hge.test
b/clients/Tests/MAL-signatures-hge.test
--- a/clients/Tests/MAL-signatures-hge.test
+++ b/clients/Tests/MAL-signatures-hge.test
@@ -46584,11 +46584,6 @@ pattern io.printf(X_0:streams, X_1:str,
IOprintfStream;
Select default format
io
-setmallocsuccesscount
-command io.setmallocsuccesscount(X_0:lng):void
-IOsetmallocsuccesscount;
-Set number of mallocs that are allowed to succeed.
-io
stdin
pattern io.stdin():bstream
io_stdin;
diff --git a/clients/Tests/MAL-signatures.test
b/clients/Tests/MAL-signatures.test
--- a/clients/Tests/MAL-signatures.test
+++ b/clients/Tests/MAL-signatures.test
@@ -35074,11 +35074,6 @@ pattern io.printf(X_0:streams, X_1:str,
IOprintfStream;
Select default format
io
-setmallocsuccesscount
-command io.setmallocsuccesscount(X_0:lng):void
-IOsetmallocsuccesscount;
-Set number of mallocs that are allowed to succeed.
-io
stdin
pattern io.stdin():bstream
io_stdin;
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
@@ -319,7 +319,6 @@ void GDKreset(int status);
void GDKsetbuf(char *);
void GDKsetdebug(unsigned debug);
gdk_return GDKsetenv(const char *name, const char *value);
-void GDKsetmallocsuccesscount(lng count);
stream *GDKstdin;
stream *GDKstdout;
ssize_t GDKstrFromStr(unsigned char *restrict dst, const unsigned char
*restrict src, ssize_t len, char quote);
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -451,9 +451,6 @@ size_t GDK_vm_maxsize = GDK_VM_MAXSIZE;
* fall-back for other compilers. */
#include "matomic.h"
static ATOMIC_TYPE GDK_mallocedbytes_estimate = ATOMIC_VAR_INIT(0);
-#ifndef NDEBUG
-static volatile lng GDK_malloc_success_count = -1;
-#endif
static ATOMIC_TYPE GDK_vm_cursize = ATOMIC_VAR_INIT(0);
size_t _MT_pagesize = 0; /* variable holding page size */
@@ -825,12 +822,6 @@ MT_init(void)
static int THRinit(void);
static gdk_return GDKlockHome(int farmid);
-#ifndef __COVERITY__
-#ifndef NDEBUG
-static MT_Lock mallocsuccesslock = MT_LOCK_INITIALIZER(mallocsuccesslock);
-#endif
-#endif
-
void
GDKsetdebug(unsigned debug)
{
@@ -1719,19 +1710,6 @@ GDKmalloc_internal(size_t size, bool cle
size_t nsize;
assert(size != 0);
-#ifndef NDEBUG
- /* 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--;
- MT_lock_unset(&mallocsuccesslock);
- }
- if (GDK_malloc_success_count == 0) {
- GDKerror("allocation failed because of testing limit\n");
- return NULL;
- }
-#endif
#ifndef SIZE_CHECK_IN_HEAPS_ONLY
if (size > SMALL_MALLOC &&
GDKvm_cursize() + size >= GDK_vm_maxsize &&
@@ -1935,15 +1913,6 @@ GDKmallocated(const void *s)
return ((const size_t *) s)[-1]; /* how much allocated last */
}
-void
-GDKsetmallocsuccesscount(lng count)
-{
- (void) count;
-#ifndef NDEBUG
- GDK_malloc_success_count = count;
-#endif
-}
-
/*
* @- virtual memory
* allocations affect only the logical VM resources.
diff --git a/gdk/gdk_utils.h b/gdk/gdk_utils.h
--- a/gdk/gdk_utils.h
+++ b/gdk/gdk_utils.h
@@ -111,9 +111,6 @@ gdk_export void MT_init(void); /* init
struct opt;
gdk_export gdk_return GDKinit(struct opt *set, int setlen, bool embedded,
const char *caller_revision);
-/* used for testing only */
-gdk_export void GDKsetmallocsuccesscount(lng count);
-
/*
* Upon closing the session, all persistent BATs should be saved and
* the transient BATs should be removed. The buffer pool manager
diff --git a/monetdb5/mal/mal_exception.c b/monetdb5/mal/mal_exception.c
--- a/monetdb5/mal/mal_exception.c
+++ b/monetdb5/mal/mal_exception.c
@@ -85,10 +85,7 @@ createExceptionInternal(enum malexceptio
int len;
char *msg;
va_list ap2;
-#ifndef NDEBUG
- // if there is an error we allow memory allocation once again
- GDKsetmallocsuccesscount(-1);
-#endif
+
va_copy(ap2, ap); /* we need to use it twice */
msglen = strlen(exceptionNames[type]) + strlen(fcn) + 2;
len = vsnprintf(NULL, 0, format, ap); /* count necessary length */
diff --git a/monetdb5/modules/mal/mal_io.c b/monetdb5/modules/mal/mal_io.c
--- a/monetdb5/modules/mal/mal_io.c
+++ b/monetdb5/modules/mal/mal_io.c
@@ -615,14 +615,6 @@ IOtable(Client cntxt, MalBlkPtr mb, MalS
return MAL_SUCCEED;
}
-static str
-IOsetmallocsuccesscount(void *res, lng *count)
-{
- (void) res;
- GDKsetmallocsuccesscount(*count);
- return MAL_SUCCEED;
-}
-
#include "mel.h"
mel_func mal_io_init_funcs[] = {
pattern("io", "stdin", io_stdin, false, "return the input stream to the
database client", args(1,1, arg("",bstream))),
@@ -635,7 +627,6 @@ mel_func mal_io_init_funcs[] = {
pattern("io", "printf", IOprintf, false, "Select default format ", args(1,2,
arg("",void),arg("fmt",str))),
pattern("io", "printf", IOprintfStream, false, "Select default format ",
args(1,4, arg("",void),arg("filep",streams),arg("fmt",str),varargany("val",0))),
pattern("io", "printf", IOprintfStream, false, "Select default format ",
args(1,3, arg("",void),arg("filep",streams),arg("fmt",str))),
- command("io", "setmallocsuccesscount", IOsetmallocsuccesscount, false, "Set
number of mallocs that are allowed to succeed.", args(1,2,
arg("",void),arg("count",lng))),
{ .imp=NULL }
};
#include "mal_import.h"
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]