-
Notifications
You must be signed in to change notification settings - Fork 106
Fix memory leaks #553
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix memory leaks #553
Conversation
…oved dedicated function
Codecov Report
@@ Coverage Diff @@
## master #553 +/- ##
==========================================
- Coverage 74.53% 72.57% -1.97%
==========================================
Files 35 35
Lines 5648 5626 -22
==========================================
- Hits 4210 4083 -127
- Misses 1438 1543 +105
Continue to review full report at Codecov.
|
src/run_info.c
Outdated
@@ -163,6 +163,9 @@ void RAI_FreeRunInfo(struct RedisAI_RunInfo *rinfo) { | |||
return; | |||
} | |||
long long ref_count = *rinfo->dagRefCount; | |||
/* In case of client disconnect, this function will be called for cleanup. | |||
* It needs to validate the execution has finished. */ | |||
while(ref_count > 0) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be atomic?
src/DAG/dag.c
Outdated
@@ -588,7 +592,7 @@ static void _ScriptSingleOp_PersistTensors(RedisModuleCtx *ctx, RAI_DagOp *op) { | |||
const size_t noutputs = RAI_ScriptRunCtxNumOutputs(op->sctx); | |||
for (size_t outputNumber = 0; outputNumber < noutputs; outputNumber++) { | |||
RAI_Tensor *tensor = RAI_ScriptRunCtxOutputTensor(op->sctx, outputNumber); | |||
tensor = tensor ? RAI_TensorGetShallowCopy(tensor) : NULL; | |||
// tensor = tensor ? RAI_TensorGetShallowCopy(tensor) : NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comment?
src/DAG/dag.c
Outdated
@@ -768,7 +765,7 @@ int RedisAI_DagRun_Reply(RedisModuleCtx *ctx, RedisModuleString **argv, int argc | |||
} | |||
} | |||
|
|||
RAI_FreeRunInfo(rinfo); | |||
// RAI_FreeRunInfo(rinfo); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comment?
src/DAG/dag.c
Outdated
RedisAI_RunInfo *rinfo = RedisModule_GetBlockedClientPrivateData(ctx); | ||
RAI_FreeRunInfo(rinfo); | ||
void RunInfo_FreeData(RedisModuleCtx *ctx, void *rinfo) { | ||
RAI_FreeRunInfo(rinfo); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The RunInfo_FreeData is called after the reply function ends?
rinfo->OnFinish = DAG_ReplyAndUnblock; | ||
rinfo->client = RedisModule_BlockClient(ctx, RedisAI_DagRun_Reply, NULL, RunInfo_FreeData, 0); | ||
RedisModule_SetDisconnectCallback(rinfo->client, RedisAI_Disconnected); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why isn't it necessary anymore?
Uh oh!
There was an error while loading. Please reload this page.