| 55 | |
| 56 | template<typename T> |
| 57 | unique_ptr<T[], function<void(void *)>> memAlloc(const size_t &elements) { |
| 58 | // TODO: make memAlloc aware of array shapes |
| 59 | dim4 dims(elements); |
| 60 | T *ptr = static_cast<T *>( |
| 61 | memoryManager().alloc(false, 1, dims.get(), sizeof(T))); |
| 62 | return unique_ptr<T[], function<void(void *)>>(ptr, memFree); |
| 63 | } |
| 64 | |
| 65 | void *memAllocUser(const size_t &bytes) { |
| 66 | dim4 dims(bytes); |