File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -2967,7 +2967,12 @@ struct ggml_context * ggml_init(struct ggml_init_params params) {
2967
2967
2968
2968
* ctx = (struct ggml_context ) {
2969
2969
/*.mem_size =*/ params .mem_size ,
2970
- /*.mem_buffer =*/ params .mem_buffer ? params .mem_buffer : malloc (params .mem_size ),
2970
+ /*.mem_buffer =*/ params .mem_buffer ? params .mem_buffer :
2971
+ #if defined(_MSC_VER ) || defined (__MINGW32__ )
2972
+ _aligned_malloc (params .mem_size , GGML_MEM_ALIGN ),
2973
+ #else
2974
+ aligned_alloc (GGML_MEM_ALIGN , params .mem_size ),
2975
+ #endif
2971
2976
/*.mem_buffer_owned =*/ params .mem_buffer ? false : true,
2972
2977
/*.no_alloc =*/ params .no_alloc ,
2973
2978
/*.n_objects =*/ 0 ,
@@ -3002,7 +3007,11 @@ void ggml_free(struct ggml_context * ctx) {
3002
3007
__func__ , i , ctx -> n_objects , ctx -> objects_end -> offs + ctx -> objects_end -> size );
3003
3008
3004
3009
if (ctx -> mem_buffer_owned ) {
3010
+ #if defined(_MSC_VER ) || defined(__MINGW32__ )
3011
+ _aligned_free (ctx -> mem_buffer );
3012
+ #else
3005
3013
free (ctx -> mem_buffer );
3014
+ #endif
3006
3015
}
3007
3016
3008
3017
found = true;
You can’t perform that action at this time.
0 commit comments