예제 #1
0
파일: nplib.py 프로젝트: filmackay/flypy
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)
예제 #2
0
 def f():
     obj = gc.gc_alloc(1, int32)
     gc.gc_add_finalizer(obj, final)
예제 #3
0
 def f(n):
     gc.gc_disable()
     for i in range(n):
         p = gc.gc_alloc(1000, Pointer[float64])
     gc.gc_enable()
     gc.gc_collect()
예제 #4
0
 def f(n):
     for i in range(n):
         p = gc.gc_alloc(1000, Pointer[float64])
예제 #5
0
 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))
예제 #6
0
파일: nplib.py 프로젝트: pombreda/flypy
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)