Skip to content

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

@WSS0271

Description

@WSS0271

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

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions