api: fix memory leak in vl_api_cli_inband_t_handler

I noticed the memory leak while sending a lot of cli_inband APIs:

DBGvpp# memory-trace on main-heap

... send a lot of API cli_inband ...

DBGvpp# show memory main-heap
Thread 0 vpp_main
  base 0x7f85c8302000, size 1g, locked, unmap-on-destroy, name 'main heap'
    page stats: page-size 4K, total 262144, mapped 33129, not-mapped 229015
      numa 0: 33129 pages, 129.41m bytes
    total: 1023.99M, used: 125.78M, free: 898.22M, trimmable: 897.59M

  Bytes    Count     Sample   Traceback
  9751632   145034 0x7f85d01696e8 clib_mem_alloc_aligned_at_offset + 0x80
                                  vec_resize_allocate_memory + 0xa8
                                  _vec_resize_inline + 0x240
                                  va_unformat + 0xe4
                                  unformat + 0x159
                                  vlib_cli_dispatch_sub_commands + 0x11e
                                  vlib_cli_input + 0x8f
                                  vl_api_cli_inband_t_handler + 0xd9
                                  vl_msg_api_handler_with_vm_node + 0x488
                                  void_mem_api_handle_msg_i + 0x6f
                                  vl_mem_api_handle_msg_main + 0x38
                                  vl_api_clnt_process + 0x28d
  9723904   145034 0x7f85cd677238 clib_mem_alloc_aligned_at_offset + 0x80
                                  vec_resize_allocate_memory + 0xa8
                                  _vec_resize_inline + 0x240
                                  unformat_init_string + 0x10d
                                  vl_api_cli_inband_t_handler + 0xc1
                                  vl_msg_api_handler_with_vm_node + 0x488
                                  void_mem_api_handle_msg_i + 0x6f
                                  vl_mem_api_handle_msg_main + 0x38
                                  vl_api_clnt_process + 0x28d
                                  vlib_process_bootstrap + 0x5d
                                  0x7f8608b0e038
290077 total traced objects

Solution: free the input data structure.

Type: fix
Change-Id: I42de5572e8760237e793a53c1a94bce65a4ac5fa
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
1 file changed
tree: f1c068c42d1038433f73f43b353edf273824c4b1
  1. build/
  2. build-data/
  3. build-root/
  4. docs/
  5. doxygen/
  6. extras/
  7. src/
  8. test/
  9. .clang-format
  10. .git_commit_template.txt
  11. .gitignore
  12. .gitreview
  13. INFO.yaml
  14. LICENSE
  15. MAINTAINERS
  16. Makefile
  17. README.md
  18. RELEASE.md
README.md

Vector Packet Processing

Introduction

The VPP platform is an extensible framework that provides out-of-the-box production quality switch/router functionality. It is the open source version of Cisco's Vector Packet Processing (VPP) technology: a high performance, packet-processing stack that can run on commodity CPUs.

The benefits of this implementation of VPP are its high performance, proven technology, its modularity and flexibility, and rich feature set.

For more information on VPP and its features please visit the FD.io website and What is VPP? pages.

Changes

Details of the changes leading up to this version of VPP can be found under @ref release_notes.

Directory layout

Directory nameDescription
build-dataBuild metadata
build-rootBuild output directory
doxygenDocumentation generator configuration
dpdkDPDK patches and build infrastructure
@ref extras/libmemifClient library for memif
@ref src/examplesVPP example code
@ref src/pluginsVPP bundled plugins directory
@ref src/svmShared virtual memory allocation library
src/testsStandalone tests (not part of test harness)
src/vatVPP API test program
@ref src/vlibVPP application library
@ref src/vlibapiVPP API library
@ref src/vlibmemoryVPP Memory management
@ref src/vnetVPP networking
@ref src/vppVPP application
@ref src/vpp-apiVPP application API bindings
@ref src/vppinfraVPP core library
@ref src/vpp/apiNot-yet-relocated API bindings
testUnit tests and Python test harness

Getting started

In general anyone interested in building, developing or running VPP should consult the VPP wiki for more complete documentation.

In particular, readers are recommended to take a look at [Pulling, Building, Running, Hacking, Pushing](https://wiki.fd.io/view/VPP/Pulling,_Building,_Run ning,_Hacking_and_Pushing_VPP_Code) which provides extensive step-by-step coverage of the topic.

For the impatient, some salient information is distilled below.

Quick-start: On an existing Linux host

To install system dependencies, build VPP and then install it, simply run the build script. This should be performed a non-privileged user with sudo access from the project base directory:

./extras/vagrant/build.sh

If you want a more fine-grained approach because you intend to do some development work, the Makefile in the root directory of the source tree provides several convenience shortcuts as make targets that may be of interest. To see the available targets run:

make

Quick-start: Vagrant

The directory extras/vagrant contains a VagrantFile and supporting scripts to bootstrap a working VPP inside a Vagrant-managed Virtual Machine. This VM can then be used to test concepts with VPP or as a development platform to extend VPP. Some obvious caveats apply when using a VM for VPP since its performance will never match that of bare metal; if your work is timing or performance sensitive, consider using bare metal in addition or instead of the VM.

For this to work you will need a working installation of Vagrant. Instructions for this can be found [on the Setting up Vagrant wiki page] (https://wiki.fd.io/view/DEV/Setting_Up_Vagrant).

More information

Several modules provide documentation, see @subpage user_doc for more end-user-oriented information. Also see @subpage dev_doc for developer notes.

Visit the VPP wiki for details on more advanced building strategies and other development notes.

Test Framework

There is PyDoc generated documentation available for the VPP test framework. See @ref test_framework_doc for details.