What expectations does F
have about its parameter E
?
void F(CExpression *E) {
do_something_with_E(...);
...
E->foo();
}
static CExpression *GV = ...;
void do_something_with_E(CExpression *E) {
stuff(E);
GV->Release();
GV = ExpressionFactory(...);
bar();
}
struct CGroupExpression : CRefCount<CGroupExpression> {
COperator *pop_;
CGroupExpression(COperator *pop) : pop_(pop) {}
~CGroupExpression() {
pop_->Release();
}
}
CGroupExpression *G(COperator *O) {
pop->AddRef();
CGroupExpression *GE = GPOS_NEW(mp) CGroupExpression(pop);
return GE;
}
template <class T, class = std::enable_if_t<std::is_pointer<T>::value>>
using owner = T;
owner<CGroupExpression*> G(COperator *O) {
pop->AddRef();
owner<CGroupExpression*> GE = GPOS_NEW(mp) CGroupExpression(pop);
return GE;
}
-
locally created and then destroyed pair GPOS_NEW() / Release()
libgpopt/include/gpopt/base/CStateMachine.h:491
CStateMachine::OsDiagramToGraphviz
-
In destructors
libgpdbcost/src/CCostModelGPDB.cpp:161
CCostModelGPDB::~CCostModelGPDB
-
local variables, returned from a ownership-returning function
libgpopt/include/gpopt/base/CUtils.h:1294
CUtils::PexprLogicalCorrelatedQuantifiedApply
libgpopt/include/gpopt/xforms/CXformApply2Join.h:202
CXformApply2Join::Decorrelate