Skip to content

v2Cpp存在内存泄漏的问题 #137

Description

@makabakadot

BinaryReader类中 std::vector<void*> mObjects内的void*对象好像没有正确释放。BinaryReader类中没看见相关方法释放这些储存的指针。之后BinaryReader将容器内的指针返出去,外面的ISerializable实例读取后好像也没有正确释放这些指针。BinaryReader实例作为局部变量在L2DBaseModel::loadModelData方法结束后被析构,无法管理mObjects内的指针,转移所有权的ISerializable实例们也没释放。最终容器内的 void*指针没有delete,出现内存泄漏。
比如IDrawData类的PivotManager* mPivotMgr
IDrawData类没有重写它的析构函数,它的子类Mesh也没有将PivotManager* mPivotMgr释放。后面如果没有别的地方释放PivotManager* mPivotMgr就会导致它指针指向的内存泄漏。

class IDrawData : public ISerializable {
public:
//在read里读取的
    void read(class BinaryReader& br) override;
protected:
//这个指针没有delete
    PivotManager* mPivotMgr = nullptr;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions