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

Added two options to avoid using excessive memory #727

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

evolution536
Copy link

Hello,

I'm using PyShark to manage T-Shark workers that capture packets 24/7 in the background. I only need the packets to be written to a file, and therefore, I don't need the packets in memory and I don't need T-Shark to dissect everything. When I use PyShark this way, I encounter two problems:

  1. PyShark keeps packets in memory and that is consuming a lot of memory. OOM comes by and kills it within a couple of hours.
  2. T-Shark uses excessive CPU and memory because it tries to dissect everything.

Therefore I made some changes to the code and I want to propose them to be merged for everybody to use. I introduced two options:

  1. store_packets which can be set to False to avoid packets to be kept in the internal list;
  2. disable_dissection which can be set to True to pass the --disable-all-protocols switch to T-Shark.

This works for me, as memory and CPU usage is down by so much that it is feasible. Implemented the options in the LiveRingCapture class too, but did not test it.

I apologize for the CRLF endings that the Windows Git might have put on.

Gijs Rijnders added 2 commits January 9, 2025 10:13
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 this pull request may close these issues.

1 participant