Bug #81135 Remove NdbMem wrappers
Submitted: 19 Apr 2016 7:00 Modified: 28 Apr 2016 13:25
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 7:00] Magnus Blåudd
Description:
The NdbMem_Allocate() and NdbMem_Free() functions are simply wrapper around malloc() and free() repectively. This is just obfuscating the code and developers use these functions by copy&paste probably thinking they use some clever memory allocation technique. To avoid this obfuscation the functions should be removed. Especially since they are not used consistently in the code.  Direct usage of malloc() and free() are much clearer and well known. These functions was added long time ago when making ndb run on embedded systems which it now does even without these wrapper functions.

Also the function NdbMem_AllocateAlign() is unused and can be removed.

The functions NdbMem_Create() and NdbMem_Destroy() have no effect and can be removed.

The only portability layer functions to be left in NdbMem.h are the functions for locking memory.

How to repeat:
MCI

Suggested fix:
Remove as suggested, use malloc/free directly.
[28 Apr 2016 13:25] Jon Stephens
Code refactoring only, no user-visible changes.

Closed.
[28 Apr 2016 13:25] Jon Stephens
(Fixed in NDB 7.5.2.)