[dpdk-dev,v2] eal/service: add routine to release memory
Checks
Commit Message
The routine rte_service_finalize checks if service is initialized,
if yes; releases internal memory for services and lcore states.
This routine is to be invoked at end of application termination.
Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
---
V2 Changes:
- redo the logic for rte_service_finalize
- added in alphabetical order
- cleaned up commit message
---
lib/librte_eal/common/rte_service.c | 16 +++++++++-------
lib/librte_eal/rte_eal_version.map | 2 +-
2 files changed, 10 insertions(+), 8 deletions(-)
@@ -110,14 +110,16 @@ int32_t rte_service_init(void)
void rte_service_finalize(void)
{
- if (rte_service_library_initialized) {
- if (rte_services)
- rte_free(rte_services);
- if (lcore_states)
- rte_free(lcore_states);
+ if (!rte_service_library_initialized)
+ return;
- rte_service_library_initialized = 0;
- }
+ if (rte_services)
+ rte_free(rte_services);
+
+ if (lcore_states)
+ rte_free(lcore_states);
+
+ rte_service_library_initialized = 0;
}
@@ -223,6 +223,7 @@ EXPERIMENTAL {
rte_service_component_unregister;
rte_service_component_runstate_set;
rte_service_dump;
+ rte_service_finalize;
rte_service_get_by_id;
rte_service_get_by_name;
rte_service_get_count;
@@ -245,6 +246,5 @@ EXPERIMENTAL {
rte_service_set_runstate_mapped_check;
rte_service_set_stats_enable;
rte_service_start_with_defaults;
- rte_service_finalize;
} DPDK_18.02;