ithewei / ithewei/libhv

hloop_post_event并伴随着malloc内存时,如果生产ev速度大于处理速度,怎么防止崩溃?

Open
#818 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
7.6k
Forks
1.4k
Avg merge
1d 21h
Merged PRs (30d)
9

Description

工况:我需要监测10+设备的告警,每种告警大约几十种告警。发生告警,我会malloc告警信息,hloop_post_event,用其处理函数写文件。

问题:我担心生产速度大于消费速度,event_queue_push_back还会一直加大消息数量,没有限制。我想能不能限制loop->custom_events的数量,大于预期值,大不了就丢弃,别把内存搞崩溃!!

方法:我想要么做个预期最大值,要么提供查询custom_events数量的接口,怎么判断,或者有什么好办法吗?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.