mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-06 19:38:41 +03:00
limit memcpy as rep stosb to windows where the cpu supporst FSRM; add mi_memcpy_aligned for machine-word aligned copy. see issue #201 and pr #253
This commit is contained in:
parent
92ec493a5d
commit
35c1fc2be9
6 changed files with 77 additions and 24 deletions
|
@ -193,7 +193,7 @@ mi_heap_t* mi_heap_new(void) {
|
|||
mi_heap_t* bheap = mi_heap_get_backing();
|
||||
mi_heap_t* heap = mi_heap_malloc_tp(bheap, mi_heap_t); // todo: OS allocate in secure mode?
|
||||
if (heap==NULL) return NULL;
|
||||
_mi_memcpy(heap, &_mi_heap_empty, sizeof(mi_heap_t));
|
||||
_mi_memcpy_aligned(heap, &_mi_heap_empty, sizeof(mi_heap_t));
|
||||
heap->tld = bheap->tld;
|
||||
heap->thread_id = _mi_thread_id();
|
||||
_mi_random_split(&bheap->random, &heap->random);
|
||||
|
@ -220,7 +220,7 @@ static void mi_heap_reset_pages(mi_heap_t* heap) {
|
|||
#ifdef MI_MEDIUM_DIRECT
|
||||
memset(&heap->pages_free_medium, 0, sizeof(heap->pages_free_medium));
|
||||
#endif
|
||||
_mi_memcpy(&heap->pages, &_mi_heap_empty.pages, sizeof(heap->pages));
|
||||
_mi_memcpy_aligned(&heap->pages, &_mi_heap_empty.pages, sizeof(heap->pages));
|
||||
heap->thread_delayed_free = NULL;
|
||||
heap->page_count = 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue