Memory intensive native plugin seeing ~6x slowdown
Hello all,
I've got a C++ library that I'm using with an iOS native plugin under Unity. The plugin is very memory intensive even running under just iOS -- allocating/deallocating memory and just overall memory pressure. When I run it as a native plugin though, I'm seeing a near 6x slowdown and it seems to mostly stem from memory allocation/deallocation. Profiling under Xcode I'm seeing a lot of time spent in MemoryManager::Deallocate()
and BaseAllocator::TryDeallocate()
(both of which are definitely not my classes). These are coming from creating std::vector
's and also cv::Mat
's. It seems as though my code is running on top of some sort of layer setup by Unity? This seems contrary to the point of a native plugin though.
Am I doing something wrong here or is this to be expected?
Thanks!