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

看错了 #1577

Closed
liubuyang opened this issue Nov 3, 2022 · 0 comments
Closed

看错了 #1577

liubuyang opened this issue Nov 3, 2022 · 0 comments

Comments

@liubuyang
Copy link

LevelPtr ScriptLevel::getScriptDebug() {
static const LevelPtr scriptlv(new ScriptLevel(ScriptLevel::SCRIPT_INT, LOG4CXX_STR("S_DBG"), 7));
return scriptlv;
}

每次调用getScriptDebug()都会调用new 申请内存,并没有释放。
涉及下面5个方法,建议修改
static LevelPtr getScriptInfo();
static LevelPtr getScriptWarning();
static LevelPtr getScriptError();
static LevelPtr getScriptDebug();
static LevelPtr getScript();

有以下方案:
static const LevelPtr scriptDebug(new ScriptLevel(ScriptLevel::SCRIPT_INT, LOG4CXX_STR("S_DBG"), 7));
LevelPtr ScriptLevel::getScriptDebug() {
return scriptDebug;
}

@liubuyang liubuyang changed the title 日志系统内存泄漏script_loglevel.cpp 日志系统script_loglevel.cpp Nov 3, 2022
@liubuyang liubuyang changed the title 日志系统script_loglevel.cpp 看错了 Nov 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant