Memory allocated with _aligned_malloc on WIN32 should be released with _aligned_free.
If icd/common/icd-instance is ever used on WIN32 it will now use _aligned_free.
loader_aligned_heap_alloc and loader_aligned_alloc would require additional
matching loader_aligned*_free functions to be correct for WIN32.
But both functions are never used. Just remove those functions for now.
static void VKAPI default_free(void *user_data, void *ptr)
{
+#if defined(_WIN32)
+ _aligned_free(ptr);
+#else
free(ptr);
+#endif
}
struct icd_instance *icd_instance_create(const VkApplicationInfo *app_info,
return malloc(size);
}
-void* loader_aligned_heap_alloc(
- const struct loader_instance *instance,
- size_t size,
- size_t alignment,
- VkSystemAllocType alloc_type)
-{
- if (instance && instance->alloc_callbacks.pfnAlloc) {
- return instance->alloc_callbacks.pfnAlloc(instance->alloc_callbacks.pUserData, size, alignment, alloc_type);
- }
-#if defined(_WIN32)
- return _aligned_malloc(alignment, size);
-#else
- return aligned_alloc(alignment, size);
-#endif
-}
-
void loader_heap_free(
const struct loader_instance *instance,
void *pMem)
size_t size,
VkSystemAllocType allocType);
-void* loader_aligned_heap_alloc(
- const struct loader_instance *instance,
- size_t size,
- size_t alignment,
- VkSystemAllocType allocType);
-
void loader_heap_free(
const struct loader_instance *instance,
void *pMem);
}
#define loader_stack_alloc(size) alloca(size)
-static inline void *loader_aligned_alloc(size_t alignment, size_t size) { void *ptr; posix_memalign(&ptr, alignment, size); return ptr; }
#elif defined(_WIN32) // defined(__linux__)
/* Windows-specific common code: */
#define DeleteCriticalSection PLEASE USE THE loader_platform_thread_delete_mutex() FUNCTION
#define loader_stack_alloc(size) _alloca(size)
-static inline void *loader_aligned_alloc(size_t alignment, size_t size) { return _aligned_malloc(alignment, size); }
#endif // defined(_WIN32)
#endif /* LOADER_PLATFORM_H_TEMP */