Bug #126
closedRadix tree implementation leaks memory
Description
The radix tree implementation leaks memory in several places. This causes the current ip-only matching code to fill up the memory. When running a large pcap the memory usage grows to 6GB+ easily (at this point I killed the process).
The issue seems to be that in SCRadixFindKey an object "prefix" is created, but it's not freed at all in cases where the function returns NULL and possibly never ever. The same issue seems to be present in SCRadixAddKey and SCRadixRemoveKey at least.
Please completely review the radix implementation.
Files
Updated by Pablo Rincon over 14 years ago
- File 0004-Release-the-tmp-prefix-used-for-searching-on-the-rad.patch 0004-Release-the-tmp-prefix-used-for-searching-on-the-rad.patch added
- File 0005-Unittest-used-to-check-the-radix-memleak-located-at-.patch 0005-Unittest-used-to-check-the-radix-memleak-located-at-.patch added
- File 0006-Register-the-free-function-for-nodes-of-the-radix-tr.patch 0006-Register-the-free-function-for-nodes-of-the-radix-tr.patch added
- % Done changed from 0 to 100
Right, it was the temporal prefix. Was never free(). I have fixed some unittests that were creating the radix trees without registering a free() function for the userdatas and added a unittest to loop searching (with the mem leak the mem usage was dramatically increased, but now it keeps stable).
Updated by Victor Julien over 14 years ago
- Status changed from New to Closed
Patches applied, thanks Pablo. I did remove the loop from the test introduced in the 0005 patch.