librime icon indicating copy to clipboard operation
librime copied to clipboard

librime doesn't release memory after maintainence

Open wengxt opened this issue 4 years ago • 3 comments

Not sure if we use the API right, but we just simply call start_maintainence.

ibus-rime seems to be affected the same issue.

Easy way to reproduce it to remove all all start and start from a clean environment. The initial deployment will not release its memory.

图片

wengxt avatar Jan 18 '21 17:01 wengxt

Similar issue: https://github.com/rime/squirrel/issues/134 no memory leak was found previously.

lotem avatar Jan 19 '21 04:01 lotem

There are many tricks may be take if you think the issue is about STL container.

  1. shrink_to_fit , but mostly limited to vector
  2. do deep copy on the data.

Have you ever tried to use run heap profiler like massif to see where can be improved?

wengxt avatar Jan 19 '21 04:01 wengxt

There are many tricks may be take if you think the issue is about STL container.

  1. shrink_to_fit , but mostly limited to vector
  2. do deep copy on the data.

Have you ever tried to use run heap profiler like massif to see where can be improved?

No, I haven't. I don't think improving dictionary building is worth the effort. Ideally deployment should be done offline. https://github.com/rime/weasel has it implemented as a separate depoyer process. For Linux and macOS, there is the rime_deployer executable to do the same, but it has to access user data files exclusively. The missing part is a cross-platform way to communicate with the running engine process and temporarily put it in maintenance mode.

lotem avatar Jan 19 '21 05:01 lotem