Bug #81134 TransporterFacade useless usage of dynamic memory
Submitted: 19 Apr 2016 6:51 Modified: 2 May 2016 15:56
Reporter: Magnus Blåudd Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:7.5.2 OS:Any
Assigned to: CPU Architecture:Any

[19 Apr 2016 6:51] Magnus Blåudd
Description:
The TransporterFacade constructor initializes an array of mutexes, while doing this it gives each mutex a name by using the NdbMutex_InitWithName() function and formatting a string using dynamic memory via the BaseString class. Since the length of the string is well known it would suite better to use stack allocated memory and use a small buffer for the string containing the name of the mutex.

How to repeat:
MCI

Suggested fix:
Use a char buffer with constant size allocated on the stack, then use BaseString::snprintf() to format the name for the mutex.
[2 May 2016 15:56] Jon Stephens
Documented fix in the NDB 7.5.2 changelog, as follows:

    Improved memory usage by the internal TransporterFacade 
    constructor when performing mutex array initialization.

Closed.