fix: use malloc
instead of posix_memalign
in ggml-metal.m
to make it not crash Electron proccesses
This commit is contained in:
parent
842500144e
commit
571dca5715
1 changed files with 3 additions and 4 deletions
|
@ -264,10 +264,9 @@ static void ggml_metal_log(enum ggml_log_level level, const char * format, ...){
|
||||||
}
|
}
|
||||||
|
|
||||||
static void * ggml_metal_host_malloc(size_t n) {
|
static void * ggml_metal_host_malloc(size_t n) {
|
||||||
void * data = NULL;
|
void * data = malloc(n);
|
||||||
const int result = posix_memalign((void **) &data, sysconf(_SC_PAGESIZE), n);
|
if (data == null) {
|
||||||
if (result != 0) {
|
GGML_METAL_LOG_ERROR("%s: error: malloc failed\n", __func__);
|
||||||
GGML_METAL_LOG_ERROR("%s: error: posix_memalign failed\n", __func__);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue