示例#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)