As far as i know, AcArray uses acdbAlloc/acdbFree for memory management.
If you want to use default malloc/free for your library.
You can explicitly allocate physical buffer for AcArray types to avoid this
e.g.)
AcArray<AcGePoint3d> output;
output.setPhysicalLength(<enough_size>);
entity->some_function(output);
If you don't know how much buffer to be required, then you should explicitly deallocate with it
Here is some of my template code for deallocation
// Explicit AcArray memory buffer deallocation
template<typename T>
void MyAcArrayFree(AcArray<T>& buffer)
{
// Only if allocated with ::acdbAlloc
if (0 == buffer.physicalLength())
return;
// AcArray transparent structure
struct AcArrayView
{
T* mpArray;
int mPhysicalLen; // Actual buffer length.
int mLogicalLen; // Number of items in the array.
int mGrowLen; // Buffer grows by this value.
};
static_assert(sizeof(AcArray<T>) == sizeof(AcArrayView));
// Force cast to AcArray transparent structure
auto pArrayView = reinterpret_cast<AcArrayView*>(std::addressof(buffer));
// Call dtor data type T has destructor
if constexpr (std::is_destructible_v<T>)
{
for (size_t i = 0; i < pArrayView->mLogicalLen; ++i)
{
(pArrayView->mpArray + i)->~T();
}
}
// Explicitly deallocate buffer
::acdbFree(pArrayView->mpArray);
// Reset to Zero
pArrayView->mpArray = nullptr;
pArrayView->mPhysicalLen = 0;
pArrayView->mLogicalLen = 0;
}