首先是函数void CMemPoolMgr::ProcessLog()的实现问题,我觉得用下面这个不是更好理解吗?:
原来的代码:
for (; (pos2 = pos1) != NULL;)
{
m_MemoryUnitList.GetNext(pos1);
m_MemoryUnitList.GetAt(pos2)->ProcessLog();
}
更简单的代码:
{
m_MemoryUnitList.GetNext(pos)->ProcessLog();
}
然后:void CMemPoolMgr::ClearMemPoolMgr(),清除m_PoolList中的对象,这么做不是更好吗?
原来的代码:
。
for (; (pos2 = pos1) != NULL;)
{
m_PoolList.GetNext(pos1);
delete m_PoolList.GetAt(pos2);
m_PoolList.RemoveAt(pos2);
}
更简单的代码:
{
delete m_PoolList.GetHead();
m_PoolList.RemoveHead();
}
清除m_MemoryUnitList时,只做了RemoveAll()操作,为何它包含的对象不删除啊?这样不会造成类存泄露?不过我还没开始看完整的代码。今天看这个类发现了这几个地方值得改进改进




























