Project

General

Profile

Actions

Bug #126

closed

Radix tree implementation leaks memory

Added by Victor Julien over 14 years ago. Updated over 14 years ago.

Status:
Closed
Priority:
Immediate
Assignee:
Target version:
Affected Versions:
Effort:
Difficulty:
Label:

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

0004-Release-the-tmp-prefix-used-for-searching-on-the-rad.patch (2.23 KB) 0004-Release-the-tmp-prefix-used-for-searching-on-the-rad.patch the fix Pablo Rincon, 04/12/2010 08:13 AM
0005-Unittest-used-to-check-the-radix-memleak-located-at-.patch (2.11 KB) 0005-Unittest-used-to-check-the-radix-memleak-located-at-.patch a unittest that should increase the memory dramatically if the search have memleaks Pablo Rincon, 04/12/2010 08:13 AM
0006-Register-the-free-function-for-nodes-of-the-radix-tr.patch (4.71 KB) 0006-Register-the-free-function-for-nodes-of-the-radix-tr.patch fix the current unittests registering a free() function when the trees are created Pablo Rincon, 04/12/2010 08:13 AM

Updated by Pablo Rincon over 14 years ago

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).

Actions #2

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.

Actions

Also available in: Atom PDF