def empty(shape, dtype): items = product(shape) p = gc.gc_alloc(items, dtype) data = cast(p, Pointer[dtype]) dims = c_layout_from_shape(shape, dtype) return NDArray(data, dims, dtype)
def f(): obj = gc.gc_alloc(1, int32) gc.gc_add_finalizer(obj, final)
def f(n): gc.gc_disable() for i in range(n): p = gc.gc_alloc(1000, Pointer[float64]) gc.gc_enable() gc.gc_collect()
def f(n): for i in range(n): p = gc.gc_alloc(1000, Pointer[float64])
def test_boehm_direct(self): """Test direct usage of boehm """ ptr = gc.gc_alloc(1000, Pointer[float64]) # Make sure we have a valid pointer returned from gc.gc_alloc self.assertTrue(ptr.value != 0, str(ptr))