Tag: stdvector

非指针types的C ++向量是否会在iOS中导致内存泄漏?

代码如下: @interface myClass { std::vector<float> myVector } @end 根据仪器泄漏。 这是堆栈跟踪: 1 libstdc++.6.dylib operator new(unsigned long) 2 __gnu_cxx::new_allocator<float>::allocate(unsigned long, void const*) 3 std::_Vector_base<float, std::allocator<float> >::_M_allocate(unsigned long) 我猜我应该在堆上分配vector,但我仍然不明白为什么会出现这种情况。 也有可能我没有正确地释放课程。