Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure to use proper allocator to free #11381

Merged
merged 2 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/iocore/cache/CacheDir.cc
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ dir_lookaside_cleanup(Stripe *stripe)
DDbg(dbg_ctl_dir_lookaside, "cleanup %X %X cleaned up", b->evac_frags.earliest_key.slice32(0),
b->evac_frags.earliest_key.slice32(1));
i.remove(b);
free_CacheVC(b->earliest_evacuator);
free_CacheEvacuateDocVC(b->earliest_evacuator);
free_EvacuationBlock(b, stripe->mutex->thread_holding);
b = nb;
goto Lagain;
Expand Down
8 changes: 4 additions & 4 deletions src/iocore/cache/CacheEvacuateDocVC.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ CacheEvacuateDocVC::evacuateDocDone(int /* event ATS_UNUSED */, Event * /* e ATS
earliest_evac->total_len += doc->data_len();
if (earliest_evac->total_len == earliest_evac->doc_len) {
dir_lookaside_fixup(&evac->earliest_key, this->stripe);
free_CacheVC(earliest_evac);
free_CacheEvacuateDocVC(earliest_evac);
}
}
}
Expand Down Expand Up @@ -138,7 +138,7 @@ CacheEvacuateDocVC::evacuateDocDone(int /* event ATS_UNUSED */, Event * /* e ATS
break;
}
}
return free_CacheVC(this);
return free_CacheEvacuateDocVC(this);
}

int
Expand Down Expand Up @@ -190,7 +190,7 @@ CacheEvacuateDocVC::evacuateReadHead(int /* event ATS_UNUSED */, Event * /* e AT
// the whole document has been evacuated. Insert the directory
// entry in the directory.
dir_lookaside_fixup(&earliest_key, this->stripe);
return free_CacheVC(this);
return free_CacheEvacuateDocVC(this);
}
return EVENT_CONT;
Lcollision:
Expand All @@ -203,5 +203,5 @@ CacheEvacuateDocVC::evacuateReadHead(int /* event ATS_UNUSED */, Event * /* e AT
}
Ldone:
dir_lookaside_remove(&earliest_key, this->stripe);
return free_CacheVC(this);
return free_CacheEvacuateDocVC(this);
}
2 changes: 1 addition & 1 deletion src/iocore/cache/CacheWrite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ Stripe::evacuateDocReadDone(int event, Event *e)
}
return evacuateWrite(doc_evacuator, event, e);
Ldone:
free_CacheVC(doc_evacuator);
free_CacheEvacuateDocVC(doc_evacuator);
doc_evacuator = nullptr;
return aggWrite(event, e);
}
Expand Down
22 changes: 19 additions & 3 deletions src/iocore/cache/P_CacheInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,9 @@ struct CacheRemoveCont : public Continuation {
};

// Global Data
extern ClassAllocator<CacheVC> cacheVConnectionAllocator;
extern CacheSync *cacheDirSync;
extern ClassAllocator<CacheVC> cacheVConnectionAllocator;
extern ClassAllocator<CacheEvacuateDocVC> cacheEvacuateDocVConnectionAllocator;
extern CacheSync *cacheDirSync;
// Function Prototypes
int cache_write(CacheVC *, CacheHTTPInfoVector *);
int get_alternate_index(CacheHTTPInfoVector *cache_vector, CacheKey key);
Expand All @@ -170,7 +171,7 @@ new_CacheVC(Continuation *cont)
}

inline int
free_CacheVC(CacheVC *cont)
free_CacheVCCommon(CacheVC *cont)
{
static DbgCtl dbg_ctl{"cache_free"};
Dbg(dbg_ctl, "free %p", cont);
Expand Down Expand Up @@ -219,10 +220,25 @@ free_CacheVC(CacheVC *cont)
#ifdef DEBUG
SET_CONTINUATION_HANDLER(cont, &CacheVC::dead);
#endif
return EVENT_DONE;
}

inline int
free_CacheVC(CacheVC *cont)
{
free_CacheVCCommon(cont);
THREAD_FREE(cont, cacheVConnectionAllocator, this_thread());
return EVENT_DONE;
}

inline int
free_CacheEvacuateDocVC(CacheEvacuateDocVC *cont)
{
free_CacheVCCommon(cont);
THREAD_FREE(cont, cacheEvacuateDocVConnectionAllocator, this_thread());
return EVENT_DONE;
}

inline int
CacheVC::calluser(int event)
{
Expand Down