Blame malloc/tst-mxfast.c
|
Packit Service |
9546ae |
/* Test that glibc.malloc.mxfast tunable works.
|
|
Packit Service |
0193e1 |
Copyright (C) 2019 Free Software Foundation, Inc.
|
|
Packit Service |
9546ae |
This file is part of the GNU C Library.
|
|
Packit Service |
9546ae |
|
|
Packit Service |
9546ae |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit Service |
9546ae |
modify it under the terms of the GNU Lesser General Public
|
|
Packit Service |
9546ae |
License as published by the Free Software Foundation; either
|
|
Packit Service |
9546ae |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit Service |
9546ae |
|
|
Packit Service |
9546ae |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit Service |
9546ae |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
9546ae |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
9546ae |
Lesser General Public License for more details.
|
|
Packit Service |
9546ae |
|
|
Packit Service |
9546ae |
You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
9546ae |
License along with the GNU C Library; if not, see
|
|
Packit Service |
9546ae |
<http://www.gnu.org/licenses/>. */
|
|
Packit Service |
9546ae |
|
|
Packit Service |
9546ae |
/* This test verifies that setting the glibc.malloc.mxfast tunable to
|
|
Packit Service |
9546ae |
zero results in free'd blocks being returned to the small bins, not
|
|
Packit Service |
9546ae |
the fast bins. */
|
|
Packit Service |
9546ae |
|
|
Packit Service |
9546ae |
#include <malloc.h>
|
|
Packit Service |
0193e1 |
#include <support/check.h>
|
|
Packit Service |
9546ae |
|
|
Packit Service |
9546ae |
int
|
|
Packit Service |
0193e1 |
do_test (void)
|
|
Packit Service |
9546ae |
{
|
|
Packit Service |
9546ae |
struct mallinfo m;
|
|
Packit Service |
0193e1 |
char *volatile p1;
|
|
Packit Service |
0193e1 |
char *volatile p2;
|
|
Packit Service |
9546ae |
|
|
Packit Service |
9546ae |
/* Arbitrary value; must be in default fastbin range. */
|
|
Packit Service |
9546ae |
p1 = malloc (3);
|
|
Packit Service |
9546ae |
/* Something large so that p1 isn't a "top block" */
|
|
Packit Service |
9546ae |
p2 = malloc (512);
|
|
Packit Service |
9546ae |
free (p1);
|
|
Packit Service |
9546ae |
|
|
Packit Service |
0193e1 |
m = mallinfo ();
|
|
Packit Service |
9546ae |
|
|
Packit Service |
9546ae |
/* This will fail if there are any blocks in the fastbins. */
|
|
Packit Service |
0193e1 |
TEST_COMPARE (m.smblks, 0);
|
|
Packit Service |
9546ae |
|
|
Packit Service |
9546ae |
/* To keep gcc happy. */
|
|
Packit Service |
9546ae |
free (p2);
|
|
Packit Service |
9546ae |
|
|
Packit Service |
9546ae |
return 0;
|
|
Packit Service |
9546ae |
}
|
|
Packit Service |
9546ae |
|
|
Packit Service |
9546ae |
#include <support/test-driver.c>
|