IBM Support

Memory allocation difference on VMX-enabled machines

Technote (troubleshooting)


When running applications on VMX-enabled machines (i.e. POWER6, PowerPC 970, POWER7), memory allocation seems to use more memory space than on non-VMX-enabled machines.


This issue is related to memory alignment boundaries. When you use a 'new' operator on non-VMX-enabled machines, the standard malloc function aligns memory on 8-byte boundaries. This approach does not work on VMX-enabled machines, because VMX instructions require memory to be 16-byte aligned.

Instead of using the standard malloc function, in 32-bit mode the XL C++ Runtime uses the posix_memalign function for the 'new' operator to allocate memory that is on a 16-byte alignment. This alignment can cause a larger memory footprint because the memory is less closely packed. This can cause issues with some applications, particularly those whose memory usage is reaching the process memory limit.

Resolving the problem

The June 2008 IBM XL C++ Runtime PTF, and later, resolve this issue with an environment variable. To disable the 16-byte alignment on hardware with a VMX unit, the environment variable LIBCPP_NOVMX must be defined and set to 1. Users must ensure that no VMX instructions are used in their application when using this environment variable, because VMX behavior is undefined with non-16-byte aligned memory.

As an alternative solution to disabling the 16-byte alignment explained above, improvements have been made to the posix_memalign implementation that reduce the memory footprint of the 16-byte aligned memory. This improvement aligns memory on 16-byte boundaries with a lower overhead, so that VMX instructions are valid, though applications that are very close to the 32-bit memory limit may still exhibit problems. These improvements are available in the following AIX APARs and versions:

   AIX 5.3 - 5300-12:                  IZ68755
   AIX 6.1 - 6100-05:                  IZ68845
   AIX 7.1 - 7100-00:                  Base Version

Cross Reference information
Segment Product Component Platform Version Edition
Software Development XL C/C++ for AIX C/C++ Runtime AIX 9.0, 10.1, 11.1 Enterprise

Document information

More support for: XL C/C++
C/C++ Runtime

Software version: 9.0, 10.1, 11.1

Operating system(s): AIX

Software edition: Enterprise Edition

Reference #: 1390995

Modified date: 07 October 2010