diff --git a/tests/manual/test.c b/tests/manual/test.c index 1b69c64..681caf7 100644 --- a/tests/manual/test.c +++ b/tests/manual/test.c @@ -1,36 +1,36 @@ /* * Copyright 2014-2017 Milian Wolff * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include int main() { int i; // make app deterministic srand(0); void* p = malloc(1); for (i = 0; i < 10000; ++i) { - malloc(rand() % 1000); + void* __attribute__((unused)) l = malloc(rand() % 1000); usleep(100); } printf("malloc: %p\n", p); free(p); return 0; } diff --git a/tests/manual/test.cpp b/tests/manual/test.cpp index ecf4c0a..dd70a00 100644 --- a/tests/manual/test.cpp +++ b/tests/manual/test.cpp @@ -1,115 +1,115 @@ /* * Copyright 2014-2017 Milian Wolff * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include "util/config.h" #if defined(_ISOC11_SOURCE) #define HAVE_ALIGNED_ALLOC 1 #else #define HAVE_ALIGNED_ALLOC 0 #endif struct Foo { Foo() : i(new int) { } ~Foo() { delete i; } int* i; }; void asdf() { int* i = new int; printf("i in asdf: %p\n", (void*)i); } void bar() { asdf(); } void laaa() { bar(); } void split() { Foo f; asdf(); bar(); laaa(); } static Foo foo; int main() { Foo* f = new Foo; printf("new Foo: %p\n", (void*)f); delete f; char* c = new char[1000]; printf("new char[]: %p\n", (void*)c); delete[] c; void* buf = malloc(100); printf("malloc: %p\n", buf); buf = realloc(buf, 200); printf("realloc: %p\n", buf); free(buf); buf = calloc(5, 5); printf("calloc: %p\n", buf); #if HAVE_CFREE cfree(buf); #else free(buf); #endif #if HAVE_ALIGNED_ALLOC buf = aligned_alloc(16, 160); printf("aligned_alloc: %p\n", buf); free(buf); #endif buf = valloc(32); printf("valloc: %p\n", buf); free(buf); - posix_memalign(&buf, 16, 64); + int __attribute__((unused)) ret = posix_memalign(&buf, 16, 64); printf("posix_memalign: %p\n", buf); free(buf); for (int i = 0; i < 10; ++i) { laaa(); } laaa(); split(); return 0; }