MemInfo* NRT_MemInfo_alloc_safe_aligned(size_t size, unsigned align) { void *data = NULL; void *base = NRT_MemAlign(&data, size, align); memset(data, 0xCB, size); NRT_Debug(nrt_debug_print("NRT_MemInfo_alloc_safe_aligned %p %llu\n", data, size)); return NRT_MemInfo_new(data, size, nrt_internal_aligned_safe_dtor, base); }
MemInfo* NRT_MemInfo_alloc_safe(size_t size) { void *data = NRT_Allocate(size); /* Only fill up a couple cachelines with debug markers, to minimize overhead. */ memset(data, 0xCB, MIN(size, 256)); NRT_Debug(nrt_debug_print("NRT_MemInfo_alloc_safe %p %llu\n", data, size)); return NRT_MemInfo_new(data, size, nrt_internal_dtor_safe, (void*)size); }
static NRT_MemInfo * meminfo_new_from_pyobject(void *data, PyObject *ownerobj) { size_t dummy_size = 0; Py_INCREF(ownerobj); return NRT_MemInfo_new(data, dummy_size, pyobject_dtor, ownerobj); }
MemInfo* NRT_MemInfo_alloc(size_t size) { void *data = NRT_Allocate(size); NRT_Debug(nrt_debug_print("NRT_MemInfo_alloc %p\n", data)); return NRT_MemInfo_new(data, size, nrt_internal_dtor, NULL); }
MemInfo* NRT_MemInfo_alloc_safe(size_t size) { void *data = NRT_Allocate(size); memset(data, 0xCB, size); NRT_Debug(nrt_debug_print("NRT_MemInfo_alloc_safe %p %llu\n", data, size)); return NRT_MemInfo_new(data, size, nrt_internal_dtor, (void*)size); }