Open Search
    defaultallocator.h File Reference

    Classes

    class  DefaultAllocator
     
    struct  IsZeroInitialized< DefaultAllocator >
     

    Namespaces

     maxon
     

    Macros

    #define NewMem(T, cnt)
     
    #define NewMemClear(T, cnt)
     
    #define ReallocMem(p, cnt)
     

    Functions

    template<typename T >
    MAXON_ATTRIBUTE_FORCE_INLINE ResultPtr< T > _ReallocMem (T *p, Int cnt, MAXON_SOURCE_LOCATION_DECLARATION)
     
    template<typename T >
    void DeleteMem (T *&p)
     
    void DeleteConstPtrMem (const void *p)
     
    MAXON_ATTRIBUTE_FORCE_INLINE void MemCopy (void *dst, const void *src, Int size)
     
    MAXON_ATTRIBUTE_FORCE_INLINE void MemMove (void *dst, const void *src, Int size)
     
    template<typename T >
    MAXON_ATTRIBUTE_FORCE_INLINE void MemCopyType (T *dst, const T *src, Int cnt)
     
    template<typename T >
    MAXON_ATTRIBUTE_FORCE_INLINE void MemMoveType (T *dst, const T *src, Int cnt)
     
    MAXON_ATTRIBUTE_FORCE_INLINE void ClearMem (void *mem, Int size, UChar value=0)
     
    MAXON_ATTRIBUTE_FORCE_INLINE void SecureClearMem (volatile void *mem, Int size, UChar value=0)
     
    MAXON_ATTRIBUTE_FORCE_INLINE Int CompareMem (const void *block1, const void *block2, Int size)
     
    template<typename T >
    MAXON_ATTRIBUTE_FORCE_INLINE void ClearMemType (T *data_ptr, Int cnt, UChar value=0)
     
     MAXON_MEMBERTYPE_DETECTOR (IsArrayAllocator, IsArrayAllocator, std::false_type)
     

    Macro Definition Documentation

    ◆ NewMem

    #define NewMem (   T,
      cnt 
    )

    Allocates raw memory: no constructors are called! A valid memory address will be returned if cnt is 0 (unless there was not enough memory).

    Note
    This behaviour was different in Cinema 4D where nullptr was returned. THREADSAFE.
    Parameters
    [in]TType of item (e.g. Char, Float)
    [in]cntNumber of items.
    Returns
    Pointer to memory block or nullptr.

    ◆ NewMemClear

    #define NewMemClear (   T,
      cnt 
    )

    Allocates raw memory and clears it: no constructors are called! THREADSAFE.

    Parameters
    [in]TType of item (e.g. Char, Float)
    [in]cntNumber of items.
    Returns
    Pointer to memory block or nullptr.

    ◆ ReallocMem

    #define ReallocMem (   p,
      cnt 
    )

    Resizes a raw memory block : no constructors are called! The content of the memory block is preserved up to the lesser of the new and old sizes, even if the block is moved to a new location. The additional memory is not cleared, it may contain a certain byte pattern in debug mode. In case that p is a nullptr the function behaves like NewMem. If the function fails to allocate the requested block of memory a nullptr is returned and the memory block pointed to by argument p is not deallocated (it is still valid with its contents unchanged). THREADSAFE.

    Parameters
    [in]pCurrent memory block (can be nullptr)
    [in]cntNew number of items (size of the memory block is n * sizeof(T))
    Returns
    Memory block address or nullptr if resize is not possible (p is still valid in this case)