mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-01-14 00:27:59 +08:00
fix test and project
This commit is contained in:
parent
4bf63300b3
commit
c935521bf9
@ -116,7 +116,7 @@
|
|||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<ConformanceMode>Default</ConformanceMode>
|
<ConformanceMode>Default</ConformanceMode>
|
||||||
<AdditionalIncludeDirectories>../../include</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>../../include</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>MI_DEBUG=0;MI_SECURE=0;%(PreprocessorDefinitions);</PreprocessorDefinitions>
|
<PreprocessorDefinitions>MI_DEBUG=4;MI_SECURE=0;%(PreprocessorDefinitions);</PreprocessorDefinitions>
|
||||||
<CompileAs>CompileAsCpp</CompileAs>
|
<CompileAs>CompileAsCpp</CompileAs>
|
||||||
<SupportJustMyCode>false</SupportJustMyCode>
|
<SupportJustMyCode>false</SupportJustMyCode>
|
||||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||||
|
@ -38,7 +38,7 @@ int main() {
|
|||||||
// alloc_huge();
|
// alloc_huge();
|
||||||
// test_heap_walk();
|
// test_heap_walk();
|
||||||
// test_heap_arena();
|
// test_heap_arena();
|
||||||
test_align();
|
// test_align();
|
||||||
|
|
||||||
void* p1 = malloc(78);
|
void* p1 = malloc(78);
|
||||||
void* p2 = malloc(24);
|
void* p2 = malloc(24);
|
||||||
|
@ -212,24 +212,6 @@ int main(void) {
|
|||||||
result = mi_heap_contains_block(heap, p);
|
result = mi_heap_contains_block(heap, p);
|
||||||
mi_heap_destroy(heap);
|
mi_heap_destroy(heap);
|
||||||
}
|
}
|
||||||
CHECK_BODY("malloc-aligned12") {
|
|
||||||
bool ok = true;
|
|
||||||
const size_t align = 256;
|
|
||||||
for (int j = 1; j < 1000; j++) {
|
|
||||||
void* ps[1000];
|
|
||||||
for (int i = 0; i < 1000 && ok; i++) {
|
|
||||||
ps[i] = mi_malloc_aligned(j // size
|
|
||||||
, align);
|
|
||||||
if (ps[i] == NULL || ((uintptr_t)(ps[i]) % align) != 0) {
|
|
||||||
ok = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (int i = 0; i < 1000 && ok; i++) {
|
|
||||||
mi_free(ps[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
result = ok;
|
|
||||||
};
|
|
||||||
CHECK_BODY("malloc-aligned-at1") {
|
CHECK_BODY("malloc-aligned-at1") {
|
||||||
void* p = mi_malloc_aligned_at(48,32,0); result = (p != NULL && ((uintptr_t)(p) + 0) % 32 == 0); mi_free(p);
|
void* p = mi_malloc_aligned_at(48,32,0); result = (p != NULL && ((uintptr_t)(p) + 0) % 32 == 0); mi_free(p);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user