|
前期对内存池的使用,没发现过这种问题。可是这几天频繁出现crash现象。
使用的ace 5.8的版本,在win32平台的多线程下使用。
发现crash时,总是如下代码段:
while (1)
// *Warning* Do not use "continue" within this while-loop.
{
ACE_SEH_TRY
{
if (currp->size_ >= nunits) // Big enough
{
ACE_MALLOC_STATS (++this->cb_ptr_->malloc_stats_.ninuse_);
if (currp->size_ == nunits) //出现问题时,就是这句,显示currp为空指针
// Exact size, just update the pointers.
prevp->next_block_ = currp->next_block_;
else
{
// Remaining chunk is larger than requested block, so
// allocate at tail end.
ACE_MALLOC_STATS (++this->cb_ptr_->malloc_stats_.nblocks_);
currp->size_ -= nunits;
请教有经验的大侠,这会是什么原因导致的呢?
currp += currp->size_;
MALLOC_HEADER::init_ptr (&currp->next_block_,
0,
this->cb_ptr_);
currp->size_ = nunits;
}
this->cb_ptr_->freep_ = prevp;
// Skip over the MALLOC_HEADER when returning pointer.
return currp + 1;
} |
|