当前位置: 首页>>代码示例>>Python>>正文


Python SemiSpaceGC.make_a_copy方法代码示例

本文整理汇总了Python中pypy.rpython.memory.gc.semispace.SemiSpaceGC.make_a_copy方法的典型用法代码示例。如果您正苦于以下问题:Python SemiSpaceGC.make_a_copy方法的具体用法?Python SemiSpaceGC.make_a_copy怎么用?Python SemiSpaceGC.make_a_copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pypy.rpython.memory.gc.semispace.SemiSpaceGC的用法示例。


在下文中一共展示了SemiSpaceGC.make_a_copy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: make_a_copy

# 需要导入模块: from pypy.rpython.memory.gc.semispace import SemiSpaceGC [as 别名]
# 或者: from pypy.rpython.memory.gc.semispace.SemiSpaceGC import make_a_copy [as 别名]
 def make_a_copy(self, obj, objsize):
     # During a full collect, all copied objects might implicitly come
     # from the nursery.  If they do, we must add the GCFLAG_NO_YOUNG_PTRS.
     # If they don't, we count how many times they are copied and when
     # some threshold is reached we make the copy a non-movable "external"
     # object.  The threshold is MAX_SEMISPACE_AGE.
     tid = self.header(obj).tid
     # XXX the following logic is not doing exactly what is explained
     # above: any object without GCFLAG_NO_YOUNG_PTRS has its age not
     # incremented.  This is accidental: it means that objects that
     # are very often modified to point to young objects don't reach
     # the 3rd generation.  For now I'll leave it this way because
     # I'm not sure that it's a bad thing.
     if not (tid & GCFLAG_NO_YOUNG_PTRS):
         tid |= GCFLAG_NO_YOUNG_PTRS    # object comes from the nursery
     elif (tid & GCFLAG_AGE_MASK) < GCFLAG_AGE_MAX:
         tid += GCFLAG_AGE_ONE
     else:
         newobj = self.make_a_nonmoving_copy(obj, objsize)
         if newobj:
             return newobj
         tid &= ~GCFLAG_AGE_MASK
     # skip GenerationGC.make_a_copy() as we already did the right
     # thing about GCFLAG_NO_YOUNG_PTRS
     newobj = SemiSpaceGC.make_a_copy(self, obj, objsize)
     self.header(newobj).tid = tid
     return newobj
开发者ID:AishwaryaKM,项目名称:python-tutorial,代码行数:29,代码来源:hybrid.py

示例2: make_a_copy

# 需要导入模块: from pypy.rpython.memory.gc.semispace import SemiSpaceGC [as 别名]
# 或者: from pypy.rpython.memory.gc.semispace.SemiSpaceGC import make_a_copy [as 别名]
 def make_a_copy(self, obj, objsize):
     newobj = SemiSpaceGC.make_a_copy(self, obj, objsize)
     # During a full collect, all copied objects might implicitly come
     # from the nursery.  In case they do, we must add this flag:
     self.header(newobj).tid |= GCFLAG_NO_YOUNG_PTRS
     return newobj
开发者ID:AishwaryaKM,项目名称:python-tutorial,代码行数:8,代码来源:generation.py


注:本文中的pypy.rpython.memory.gc.semispace.SemiSpaceGC.make_a_copy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。