mem_test.c revision d2a50c9ba87a6c57cb310308dfe95fff2f2836e2
/*
* Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
*
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include <config.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <atf-c.h>
#include "isctest.h"
static void *
if (size == 0U)
size = 1;
}
static void
}
}
int i;
/* Local alloc, free */
if (result != ISC_R_SUCCESS)
goto out;
for (i = 0; i < 100000; i++) {
void *ptr;
}
printf("total_before=%lu, total_after=%lu, total_diff=%lu\n",
(unsigned long)diff);
/* 2048 +8 bytes extra for size_info */
/* ISC_MEMFLAG_INTERNAL */
for (i = 0; i < 100000; i++) {
void *ptr;
}
printf("total_before=%lu, total_after=%lu, total_diff=%lu\n",
(unsigned long)diff);
/* 2048 +8 bytes extra for size_info */
out:
isc_test_end();
}
}
void *ptr;
if (result != ISC_R_SUCCESS)
goto out;
printf("inuse_before=%lu, inuse_during=%lu, inuse_after=%lu\n",
(unsigned long)after);
ATF_REQUIRE_EQ(diff, 0);
out:
isc_test_end();
}
/*
* Main
*/
ATF_TP_ADD_TCS(tp) {
return (atf_no_error());
}