Skip to content

🐛 [BUG] - Potential memory leak in south ingest #1649

@Ineo-JFA

Description

@Ineo-JFA

Description

Using Fledge version v2.5.0 as part of the south 104 plugin of the project fledge-power, a potential memory leak may have been found in C/services/south/ingest.cpp according to a battery of tests ran with Valgrind, see screenshot attached.

The amount of allocated memory seem to increase over time, by increase of 48 bytes and even without the transmission of messages from the remote device. The trace shown above points to the following code at ./C/services/south/ingest.cpp:748:

ReadingSet *readingSet = new ReadingSet(m_data);
m_data->clear();
// Pass readingSet to filter chain
firstFilter->ingest(readingSet);

/*
 * If filtering removed all the readings then simply clean up m_data and
 * return.
 */
if (m_data->size() == 0)
{
	delete m_data;
	m_data = NULL;
	return;
}

Suggesting that readingSet may need to be deleted. The code snippet cited above has not been extensively modified from v2.5.0 to develop as of June 2025. Questions are as follow :

  1. Should it be the responsability of a filter or a plugin futher down in the data stream to clean up the memory allocated for readingSet at this point ?
  2. If not, could this have been resolved in newer (>v2.5.0) versions of Fledge ?

Thank you.

Environment Platform

Ubuntu 20.04.6 LTS

Fledge Version

v2.5.0

Installation

Source Code

Steps To Reproduce

1. Start a south service connected to a remote device using Fledge v2.5.0
2. Memory usage increases over time for this service

Expected Behavior

No memory leaks are expected.

Screenshots

Image

Logs

Support bundle

.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions