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

Enabling mmap on Android Devices May Cause Freezes or Crashes #34

Closed
pippocao opened this issue Nov 22, 2024 · 0 comments · Fixed by #35
Closed

Enabling mmap on Android Devices May Cause Freezes or Crashes #34

pippocao opened this issue Nov 22, 2024 · 0 comments · Fixed by #35
Assignees

Comments

@pippocao
Copy link
Collaborator

Memory mapping (mmap) performs automatic synchronization based on 4KB blocks, and this process is managed by the operating system's threads at unpredictable times beyond our control. As a result, it cannot guarantee correctness when used on a ring buffer and may introduce issues such as encountering dirty data and memory consistency problems. Additionally, it may interfere with our runtime memory. Therefore, we need a more robust verification mechanism.

In the current ring_buffer solution, which focuses on saving memory usage, mmap does have some impact. However, in the upcoming version 1.5 high-performance mode, we will use optimized data structures to further reduce the impact of mmap.

在安卓设备上启用mmap可能发生卡死或者崩溃
mmap的自动同步是不受我们控制的,他是基于4k的内存块由操作系统的内部线程在我们无法确定的时机自动进行的,因此他无法保证数据的正确性,无法保证没有内存一致性的问题。也无法保证不会反向影响我们的runtime内存,所以我们需要更可靠的高性能数据验证。

在当前版本中,ring_buffer致力于尽可能少地使用内存,mmap会有较大可能造成干扰,在接下来地1.5版本的高性能模式中,我们会通过更加精巧的数据结构,进一步规避mmap可能造成的影响。

@pippocao pippocao self-assigned this Nov 22, 2024
pippocao pushed a commit that referenced this issue Nov 22, 2024
pippocao pushed a commit that referenced this issue Nov 22, 2024
@pippocao pippocao mentioned this issue Nov 22, 2024
@pippocao pippocao linked a pull request Nov 22, 2024 that will close this issue
pippocao added a commit that referenced this issue Nov 22, 2024
@pippocao pippocao pinned this issue Nov 22, 2024
@pippocao pippocao unpinned this issue Nov 22, 2024
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

Successfully merging a pull request may close this issue.

1 participant