Fixing free.
This commit is contained in:
parent
0c19516de4
commit
cddab7ffb0
|
@ -305,7 +305,7 @@ int xe_memory_heap_free(
|
|||
if (address >= XE_MEMORY_HEAP_LOW && address < XE_MEMORY_HEAP_HIGH) {
|
||||
// Heap allocated address.
|
||||
size_t heap_guard_size = FLAGS_heap_guard_pages * 4096;
|
||||
p += heap_guard_size;
|
||||
p -= heap_guard_size;
|
||||
size_t real_size = mspace_usable_size(p);
|
||||
real_size -= heap_guard_size * 2;
|
||||
if (!real_size) {
|
||||
|
@ -313,6 +313,11 @@ int xe_memory_heap_free(
|
|||
}
|
||||
|
||||
XEIGNORE(xe_mutex_lock(memory->heap_mutex));
|
||||
if (FLAGS_heap_guard_pages) {
|
||||
DWORD old_protect;
|
||||
VirtualProtect(p, heap_guard_size, PAGE_READWRITE, &old_protect);
|
||||
VirtualProtect(p + heap_guard_size + real_size, heap_guard_size, PAGE_READWRITE, &old_protect);
|
||||
}
|
||||
mspace_free(memory->heap, p);
|
||||
if (FLAGS_log_heap) {
|
||||
xe_memory_heap_dump(memory);
|
||||
|
|
|
@ -425,7 +425,7 @@ int D3D11PixelShader::Prepare(xe_gpu_program_cntl_t* program_cntl,
|
|||
NULL,
|
||||
&handle_);
|
||||
if (FAILED(hr)) {
|
||||
XELOGE("D3D11: failed to create vertex shader");
|
||||
XELOGE("D3D11: failed to create pixel shader");
|
||||
xe_free(byte_code);
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue