]> git.puffer.fish Git - matthieu/frr.git/commit
zebra: fix show route vrf all memory consumption
authorLouis Scalbert <louis.scalbert@6wind.com>
Fri, 24 May 2024 15:06:59 +0000 (17:06 +0200)
committerLouis Scalbert <louis.scalbert@6wind.com>
Fri, 7 Jun 2024 08:13:32 +0000 (10:13 +0200)
commitcb440058f2d85d1408f932ad820c38e8e1b17191
tree0f25aeccdb517399ef469ce6336350e414661fc8
parent03b1ee7a39d1ac166f4dff62c75374f85029c918
zebra: fix show route vrf all memory consumption

0e2fc3d67f ("vtysh, zebra: Fix malformed json output for multiple vrfs
in command 'show ip route vrf all json'") has been reverted in the
previous commit. Although the fix was correct, it was consuming too muca
memory when displaying large route tables.

A root JSON object was storing all the JSON objects containing the route
tables, each containing their respective prefixes in JSON objects. This
resulted in excessive memory allocation for JSON objects, potentially
leading to an out-of-memory error on the machine.

To Fix the memory consumption issue for the "show ip[v6] route vrf all
json" command, display the tables one by one and free the memory of each
JSON object after it has been displayed.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
zebra/zebra_vty.c