mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-06 19:38:41 +03:00
Merge branch 'dev' of https://github.com/microsoft/mimalloc into dev
This commit is contained in:
commit
b893311365
50 changed files with 3847 additions and 2059 deletions
|
@ -5,7 +5,7 @@ terms of the MIT license. A copy of the license can be found in the file
|
|||
"LICENSE" at the root of this distribution.
|
||||
-----------------------------------------------------------------------------*/
|
||||
#include "mimalloc.h"
|
||||
#include "mimalloc-types.h"
|
||||
#include "mimalloc/types.h"
|
||||
|
||||
#include "testhelper.h"
|
||||
|
||||
|
@ -271,7 +271,7 @@ int main(void) {
|
|||
mi_free(p);
|
||||
};
|
||||
|
||||
|
||||
#if !(MI_TRACK_VALGRIND || MI_TRACK_ASAN)
|
||||
CHECK_BODY("fill-freed-small") {
|
||||
size_t malloc_size = MI_SMALL_SIZE_MAX / 2;
|
||||
uint8_t* p = (uint8_t*)mi_malloc(malloc_size);
|
||||
|
@ -286,6 +286,7 @@ int main(void) {
|
|||
// First sizeof(void*) bytes will contain housekeeping data, skip these
|
||||
result = check_debug_fill_freed(p + sizeof(void*), malloc_size - sizeof(void*));
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------
|
||||
|
@ -309,7 +310,7 @@ bool check_zero_init(uint8_t* p, size_t size) {
|
|||
|
||||
#if MI_DEBUG >= 2
|
||||
bool check_debug_fill_uninit(uint8_t* p, size_t size) {
|
||||
#if MI_VALGRIND
|
||||
#if MI_TRACK_VALGRIND || MI_TRACK_ASAN
|
||||
(void)p; (void)size;
|
||||
return true; // when compiled with valgrind we don't init on purpose
|
||||
#else
|
||||
|
@ -325,7 +326,7 @@ bool check_debug_fill_uninit(uint8_t* p, size_t size) {
|
|||
}
|
||||
|
||||
bool check_debug_fill_freed(uint8_t* p, size_t size) {
|
||||
#if MI_VALGRIND
|
||||
#if MI_TRACK_VALGRIND
|
||||
(void)p; (void)size;
|
||||
return true; // when compiled with valgrind we don't fill on purpose
|
||||
#else
|
||||
|
|
|
@ -33,8 +33,8 @@ we therefore test the API over various inputs. Please add more tests :-)
|
|||
#endif
|
||||
|
||||
#include "mimalloc.h"
|
||||
// #include "mimalloc-internal.h"
|
||||
#include "mimalloc-types.h" // for MI_DEBUG and MI_ALIGNMENT_MAX
|
||||
// #include "mimalloc/internal.h"
|
||||
#include "mimalloc/types.h" // for MI_DEBUG and MI_ALIGNMENT_MAX
|
||||
|
||||
#include "testhelper.h"
|
||||
|
||||
|
|
|
@ -5,11 +5,14 @@ terms of the MIT license. A copy of the license can be found in the file
|
|||
"LICENSE" at the root of this distribution.
|
||||
-----------------------------------------------------------------------------*/
|
||||
|
||||
/* test file for valgrind support.
|
||||
/* test file for valgrind/asan support.
|
||||
|
||||
VALGRIND:
|
||||
----------
|
||||
Compile in an "out/debug" folder:
|
||||
|
||||
> cd out/debug
|
||||
> cmake ../.. -DMI_VALGRIND=1
|
||||
> cmake ../.. -DMI_TRACK_VALGRIND=1
|
||||
> make -j8
|
||||
|
||||
and then compile this file as:
|
||||
|
@ -19,6 +22,25 @@ terms of the MIT license. A copy of the license can be found in the file
|
|||
and test as:
|
||||
|
||||
> valgrind ./test-wrong
|
||||
|
||||
|
||||
ASAN
|
||||
----------
|
||||
Compile in an "out/debug" folder:
|
||||
|
||||
> cd out/debug
|
||||
> cmake ../.. -DMI_TRACK_ASAN=1
|
||||
> make -j8
|
||||
|
||||
and then compile this file as:
|
||||
|
||||
> clang -g -o test-wrong -I../../include ../../test/test-wrong.c libmimalloc-asan-debug.a -lpthread -fsanitize=address -fsanitize-recover=address
|
||||
|
||||
and test as:
|
||||
|
||||
> ASAN_OPTIONS=verbosity=1:halt_on_error=0 ./test-wrong
|
||||
|
||||
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue