mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-06 11:34:38 +03:00
fix wrong __declspec(restrict) and __attribute__((malloc)) attributes on reallocation functions
This commit is contained in:
parent
9749c83ca0
commit
f42b8526d0
5 changed files with 168 additions and 149 deletions
|
@ -8,6 +8,25 @@
|
|||
#include <new>
|
||||
#include <vector>
|
||||
|
||||
#include <thread>
|
||||
#include <mimalloc.h>
|
||||
#include <assert.h>
|
||||
|
||||
// Issue #202
|
||||
void thread_main() {
|
||||
mi_heap_t* heap = mi_heap_new();
|
||||
void* q = mi_heap_malloc(heap,1024);
|
||||
// mi_heap_delete(heap); // uncomment to prevent assertion
|
||||
}
|
||||
|
||||
int main() {
|
||||
auto t1 = std::thread(thread_main);
|
||||
t1.join();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
static void* p = malloc(8);
|
||||
|
||||
void free_p() {
|
||||
|
@ -32,13 +51,13 @@ int main() {
|
|||
free(p1);
|
||||
p1 = malloc(8);
|
||||
char* s = mi_strdup("hello\n");
|
||||
/*
|
||||
char* s = _strdup("hello\n");
|
||||
char* buf = NULL;
|
||||
size_t len;
|
||||
_dupenv_s(&buf,&len,"MIMALLOC_VERBOSE");
|
||||
mi_free(buf);
|
||||
*/
|
||||
|
||||
//char* s = _strdup("hello\n");
|
||||
//char* buf = NULL;
|
||||
//size_t len;
|
||||
//_dupenv_s(&buf,&len,"MIMALLOC_VERBOSE");
|
||||
//mi_free(buf);
|
||||
|
||||
mi_free(p2);
|
||||
p2 = malloc(16);
|
||||
p1 = realloc(p1, 32);
|
||||
|
@ -84,4 +103,5 @@ bool test_stl_allocator2() {
|
|||
vec.push_back(some_struct());
|
||||
vec.pop_back();
|
||||
return vec.size() == 0;
|
||||
}
|
||||
}
|
||||
*/
|
Loading…
Add table
Add a link
Reference in a new issue