MCPcopy Create free account
hub / github.com/F-Stack/f-stack / memtest_alloc_and_test

Function memtest_alloc_and_test

app/redis-6.2.6/src/memtest.c:336–347  ·  view source on GitHub ↗

Perform an interactive test allocating the specified number of megabytes. */

Source from the content-addressed store, hash-verified

334
335/* Perform an interactive test allocating the specified number of megabytes. */
336void memtest_alloc_and_test(size_t megabytes, int passes) {
337 size_t bytes = megabytes*1024*1024;
338 unsigned long *m = malloc(bytes);
339
340 if (m == NULL) {
341 fprintf(stderr,"Unable to allocate %zu megabytes: %s",
342 megabytes, strerror(errno));
343 exit(1);
344 }
345 memtest_test(m,bytes,passes,1);
346 free(m);
347}
348
349void memtest(size_t megabytes, int passes) {
350#if !defined(__HAIKU__)

Callers 1

memtestFunction · 0.85

Calls 3

mallocFunction · 0.85
memtest_testFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected