]>
git.saurik.com Git - redis.git/blob - deps/jemalloc/test/rallocm.c
5 #define JEMALLOC_MANGLE
6 #include "jemalloc_test.h"
15 fprintf(stderr
, "Test begin\n");
17 r
= JEMALLOC_P(allocm
)(&p
, &sz
, 42, 0);
18 if (r
!= ALLOCM_SUCCESS
) {
19 fprintf(stderr
, "Unexpected allocm() error\n");
24 r
= JEMALLOC_P(rallocm
)(&q
, &tsz
, sz
, 0, ALLOCM_NO_MOVE
);
25 if (r
!= ALLOCM_SUCCESS
)
26 fprintf(stderr
, "Unexpected rallocm() error\n");
28 fprintf(stderr
, "Unexpected object move\n");
30 fprintf(stderr
, "Unexpected size change: %zu --> %zu\n",
35 r
= JEMALLOC_P(rallocm
)(&q
, &tsz
, sz
, 5, ALLOCM_NO_MOVE
);
36 if (r
!= ALLOCM_SUCCESS
)
37 fprintf(stderr
, "Unexpected rallocm() error\n");
39 fprintf(stderr
, "Unexpected object move\n");
41 fprintf(stderr
, "Unexpected size change: %zu --> %zu\n",
46 r
= JEMALLOC_P(rallocm
)(&q
, &tsz
, sz
+ 5, 0, ALLOCM_NO_MOVE
);
47 if (r
!= ALLOCM_ERR_NOT_MOVED
)
48 fprintf(stderr
, "Unexpected rallocm() result\n");
50 fprintf(stderr
, "Unexpected object move\n");
52 fprintf(stderr
, "Unexpected size change: %zu --> %zu\n",
57 r
= JEMALLOC_P(rallocm
)(&q
, &tsz
, sz
+ 5, 0, 0);
58 if (r
!= ALLOCM_SUCCESS
)
59 fprintf(stderr
, "Unexpected rallocm() error\n");
61 fprintf(stderr
, "Expected object move\n");
63 fprintf(stderr
, "Expected size change: %zu --> %zu\n",
69 r
= JEMALLOC_P(rallocm
)(&q
, &tsz
, 8192, 0, 0);
70 if (r
!= ALLOCM_SUCCESS
)
71 fprintf(stderr
, "Unexpected rallocm() error\n");
73 fprintf(stderr
, "Expected object move\n");
75 fprintf(stderr
, "Expected size change: %zu --> %zu\n",
81 r
= JEMALLOC_P(rallocm
)(&q
, &tsz
, 16384, 0, 0);
82 if (r
!= ALLOCM_SUCCESS
)
83 fprintf(stderr
, "Unexpected rallocm() error\n");
85 fprintf(stderr
, "Expected size change: %zu --> %zu\n",
91 r
= JEMALLOC_P(rallocm
)(&q
, &tsz
, 8192, 0, ALLOCM_NO_MOVE
);
92 if (r
!= ALLOCM_SUCCESS
)
93 fprintf(stderr
, "Unexpected rallocm() error\n");
95 fprintf(stderr
, "Unexpected object move\n");
97 fprintf(stderr
, "Expected size change: %zu --> %zu\n",
102 r
= JEMALLOC_P(rallocm
)(&q
, &tsz
, 16384, 0, ALLOCM_NO_MOVE
);
103 if (r
!= ALLOCM_SUCCESS
)
104 fprintf(stderr
, "Unexpected rallocm() error\n");
106 fprintf(stderr
, "Unexpected object move\n");
108 fprintf(stderr
, "Expected size change: %zu --> %zu\n",
113 JEMALLOC_P(dallocm
)(p
, 0);
115 fprintf(stderr
, "Test end\n");