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

[fix] : free the memory of stmt holded by ComputationWrapper manually #13646

Merged
merged 3 commits into from
Dec 26, 2023

Conversation

jensenojs
Copy link
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue # https://github.com/matrixorigin/MO-Cloud/issues/2035

What this PR does / why we need it:

在导入slooong_003的时候发现内存上涨的速度非常夸张而且没有free掉, pprof之后发现是stmts导致的,

在32GB, 16core的机器上用单CN, insert的方式导入slooong_003

手动置为nil之后在导入slooong_003时的最大内存占用在18GB, 随后回落到16GB

作为对比main在开始导入数据一分钟左右占用的内存就会突破16GB, 基本稳定在31GB左右, 有不小的概率oom

@matrix-meow matrix-meow added the size/XS Denotes a PR that changes [1, 9] lines label Dec 20, 2023
@mergify mergify bot added the kind/bug Something isn't working label Dec 20, 2023
@jensenojs jensenojs force-pushed the fix_moc2035 branch 2 times, most recently from 56393e9 to 2f40e71 Compare December 21, 2023 08:44
@matrix-meow matrix-meow added size/S Denotes a PR that changes [10,99] lines and removed size/XS Denotes a PR that changes [1, 9] lines labels Dec 21, 2023
@jensenojs jensenojs force-pushed the fix_moc2035 branch 3 times, most recently from 9a8a4c1 to 1cf0256 Compare December 25, 2023 09:04
@jensenojs
Copy link
Contributor Author

jensenojs commented Dec 25, 2023

对比

下图对比了main和修改之后的分支在导入slooong_003同一段时间之后的内存pprof情况.

main

image

free掉AST之后

image

可以看到, 存着的ast本身的内存都比free掉这部分内存之后的mo占据的所有的内存都大了...

首先这个pr的修改并不理想, 但是我们没有合适的工具找到是什么东西hold住了cwft导致这部分内存没有被gc, 后面建个issue跟踪这个事情.

等viewcore修好之后这类问题可能会好定位一些, golang/go#57447 thanks for 岳声哥 @reusee

@jensenojs jensenojs changed the title [fix] : free the memory of stmt holded by ComputationWrapper [fix] : free the memory of stmt holded by ComputationWrapper manually Dec 25, 2023
@mergify mergify bot merged commit d352fcd into matrixorigin:main Dec 26, 2023
17 of 18 checks passed
mergify bot pushed a commit that referenced this pull request Dec 26, 2023
@jensenojs jensenojs deleted the fix_moc2035 branch December 28, 2023 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working size/S Denotes a PR that changes [10,99] lines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants