本文整理汇总了C++中ObjectHandle::next方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectHandle::next方法的具体用法?C++ ObjectHandle::next怎么用?C++ ObjectHandle::next使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectHandle
的用法示例。
在下文中一共展示了ObjectHandle::next方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: garbageCollect
int MemoryManager::garbageCollect()
{
register int j;
int c=1,f=0;
if(noGC)
return 0;
if (debugging)
fprintf(stderr,"\ngarbage collecting ... \n");
for(TObjectTableIterator x = objectTable.begin(), xend = objectTable.end(); x != xend; ++x)
x->referenceCount = 0;
objectTable[0].referenceCount = 1;
/* visit symbols and firstProcess to toggle their referenceCount */
visit(symbols);
/* Visit any explicitly held references from the use of ObjectHandle */
ObjectHandle* explicitRef = ObjectHandle::getListHead();
while(explicitRef)
{
visit(*explicitRef);
explicitRef = explicitRef->next();
}
/* add new garbage to objectFreeList
* toggle referenceCount
* count the objects
*/
for (j=objectTable.size()-1; j>0; j--)
{
if (objectTable[j].referenceCount == 0)
{
if(destroyObject(j))
f++;
}
else
{
if (0!=(objectTable[j].referenceCount = -objectTable[j].referenceCount))
c++;
}
}
if (debugging)
{
fprintf(stderr," %d references.\n",ObjectHandle::numTotalHandles());
fprintf(stderr," %d objects - %d freed.\n",c,f);
}
return f;
}