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

improve: provide opts to set the truncate size in text mode to reduce memory cost #731

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yuweizzz
Copy link
Contributor

should fix #718.

@dosubot dosubot bot added the improve label Feb 10, 2025
cli/cmd/root.go Outdated Show resolved Hide resolved
user/module/imodule.go Outdated Show resolved Hide resolved
@@ -141,6 +141,11 @@ func (ew *eventWorker) writeEvent(e event.IEventStruct) {
// 解析类型,输出
func (ew *eventWorker) parserEvents() []byte {
ew.status = ProcessStateProcessing
tsize := int(ew.processor.truncateSize)
if tsize > 0 && ew.payload.Len() > tsize {
ew.payload.Truncate(tsize)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Is it just judging the size when parsing the first package? A more suitable solution should be when receiving each Event? For example
    ew.payload.Write(e.Payload())
  2. Is it the most reasonable solution to discard it directly when the payload is greater than tsize? Is it more appropriate to continue receiving after printing out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

eCapture consuming too much memory when deal bigfile in single long connection
2 participants