diff options
author | Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> | 2021-11-11 12:37:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-11 12:37:25 +0100 |
commit | acb1de69aa10b1f48abc3bae4802dc48a61eb856 (patch) | |
tree | 02de1f5135958b8b390802ff8a0e8d7811d115dd /src | |
parent | 3e5491fa109fccfb28cd170d7a1dc3e55e7531e8 (diff) |
Reduce memory used by `ndpiReader` (#1371)
`ndpiReader` is only an example, aiming to show nDPI capabilities
and integration, without any claim about performances.
Nonetheless its memory usage per flow is *huge*, limiting the kinds
of traces that we can test on a "normal" hardware (example: scan
attacks).
The key reason of that behaviour is that we preallocate all the memory
needed for *all* the available features.
Try to reduce memory usage simply allocating some structures only
when they are really needed. Most significant example: JOY algorithms.
This way we should use a lot less memory in the two most common
user-cases:
* `ndpiReader` invoked without any particular flag (i.e `ndpiReader -i
$FILENAME_OR_IFACE`)
* internal unit tests
Before (on x86_64):
```
struct ndpi_flow_info {
[...]
/* size: 7320, cachelines: 115, members: 72 */
```
After:
```
struct ndpi_flow_info {
[...]
/* size: 2128, cachelines: 34, members: 75 */
```
Diffstat (limited to 'src')
0 files changed, 0 insertions, 0 deletions