API Guide > Maya API introduction >

# Wrappers

Wrappers exist for simple objects such as math classes (like vectors or matrices). They are generally fully implemented C++ classes with public constructors and destructors. API methods may return a wrapper, which you are then responsible for—leaving scope will usually be adequate for deleting the wrapper. You are also free to allocate and deallocate them as necessary. In the previous example (Building a curve using a plug-in), MPointArray and MDoubleArray are wrappers. You always own the wrapper that you reference.

ImportantMove wrapper declarations (MIntArray, MFloatArray etc.) out of heavy loops if possible.

The constructor of a wrapper will in most cases call new to allocate the internal Maya object. As a result, if a wrapper is declared in a heavy loop memory will be allocated and de-allocated repeatedly.

This tip does not apply to static wrapper classes such as MGlobal.