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

Document Memory leak #2310

Open
iamysx opened this issue Oct 9, 2024 · 0 comments
Open

Document Memory leak #2310

iamysx opened this issue Oct 9, 2024 · 0 comments

Comments

@iamysx
Copy link

iamysx commented Oct 9, 2024

rapidjson::Document doc;
doc.Parse(str);

当doc是全局或者堆上结构中的变量数据时,由于需要重复使用,因此没有使用指针的方式
释放的时候通过doc.Clear(),释放空间,

在运行过程中内存持续增加,并且通过valgrind方式无法检测到内存泄漏点

后改成 rapidjson::Document *doc; 指针方式,每次使用时重新 new,使用完后 delete正常

想知道原因是什么呢,通过 Clear无法释放doc里面的数据内容吗?还是使用上面存在问题?

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