Skip to content

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

@pippocao

Description

@pippocao

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可能造成的影响。

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions