-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmemman.c
More file actions
43 lines (31 loc) · 750 Bytes
/
memman.c
File metadata and controls
43 lines (31 loc) · 750 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//
// memman.c
// Perceptron GLM NLP Tasks
//
// Created by husnu sensoy on 19/02/14.
// Copyright (c) 2014 husnu sensoy. All rights reserved.
//
#include "memman.h"
#include "debug.h"
#include "mkl.h"
void* mkl_64bytes_malloc(size_t bytes) {
void *buffer = mkl_malloc(bytes, 64);
check(buffer != NULL, "Memory allocation error...");
return buffer;
error:
mkl_free(buffer);
exit(1);
}
void* mkl_64bytes_realloc(void* ptr, size_t newbytes) {
void *buffer;
if (ptr == NULL){
buffer = mkl_64bytes_malloc(newbytes);
}else{
buffer = mkl_realloc(ptr, newbytes);
check(buffer != NULL, "Memory allocation error...");
}
return buffer;
error:
mkl_free(buffer);
exit(1);
}