예제 #1
0
파일: test_newgc.py 프로젝트: yuyichao/pypy
 def fn():
     s = lltype.malloc(S)
     s.u = lltype.malloc(U)
     a = lltype.malloc(A, 1000)
     gcref1 = lltype.cast_opaque_ptr(llmemory.GCREF, s)
     int1 = rgc.get_rpy_memory_usage(gcref1)
     assert 8 <= int1 <= 32
     gcref2 = lltype.cast_opaque_ptr(llmemory.GCREF, s.u)
     int2 = rgc.get_rpy_memory_usage(gcref2)
     assert 4 * 9 <= int2 <= 8 * 12
     gcref3 = lltype.cast_opaque_ptr(llmemory.GCREF, a)
     int3 = rgc.get_rpy_memory_usage(gcref3)
     assert 4 * 1001 <= int3 <= 8 * 1010
     return 0
예제 #2
0
파일: test_rgc.py 프로젝트: sota/pypy-old
def test_get_memory_usage():
    class X(object):
        pass

    x1 = X()
    n = rgc.get_rpy_memory_usage(rgc.cast_instance_to_gcref(x1))
    assert n >= 8 and n <= 64
예제 #3
0
파일: referents.py 프로젝트: cimarieta/usp
def get_rpy_memory_usage(space, w_obj):
    """Return the memory usage of just the given object or GcRef.
    This does not include the internal structures of the object."""
    gcref = unwrap(space, w_obj)
    size = rgc.get_rpy_memory_usage(gcref)
    if size < 0:
        raise missing_operation(space)
    return space.wrap(size)
예제 #4
0
def get_rpy_memory_usage(space, w_obj):
    """Return the memory usage of just the given object or GcRef.
    This does not include the internal structures of the object."""
    gcref = unwrap(space, w_obj)
    size = rgc.get_rpy_memory_usage(gcref)
    if size < 0:
        raise missing_operation(space)
    return space.newint(size)
예제 #5
0
파일: root.py 프로젝트: washort/typhon
    def sizeOf(self):
        """
        The number of bytes occupied by this object.

        The default implementation will nearly always suffice unless some
        private data is attached to the object. Private data should only be
        accounted if it does not reference any Monte-visible object.
        """

        return rgc.get_rpy_memory_usage(self)
예제 #6
0
    def sizeOf(self):
        """
        The number of bytes occupied by this object.

        The default implementation will nearly always suffice unless some
        private data is attached to the object. Private data should only be
        accounted if it does not reference any Monte-visible object.
        """

        return rgc.get_rpy_memory_usage(self)
예제 #7
0
파일: test_rgc.py 프로젝트: mozillazg/pypy
def test_get_memory_usage():
    class X(object):
        pass
    x1 = X()
    n = rgc.get_rpy_memory_usage(rgc.cast_instance_to_gcref(x1))
    assert n >= 8 and n <= 64
예제 #8
0
 def sizeOf(self):
     return (rgc.get_rpy_memory_usage(self) +
             rgc.get_rpy_memory_usage(self.bi))
예제 #9
0
파일: data.py 프로젝트: washort/typhon
 def sizeOf(self):
     return (rgc.get_rpy_memory_usage(self) +
             rgc.get_rpy_memory_usage(self.bi))