简体   繁体   English

MSVC std::_Container_base12 在 _Myproxy 中有错误的数据

[英]MSVC std::_Container_base12 has wrong data in _Myproxy

I use ENTT and add the following component to every entity.我使用 ETT 并将以下组件添加到每个实体。

    template<typename T, typename... Args>
    T& AddComponent(Args&&... args)
    {
        HZ_CORE_ASSERT(!HasComponent<T>(), "Entity already has component!");
        T& component = m_Scene->m_Registry.emplace<T>(m_EntityHandle, std::forward<Args>(args)...);
        m_Scene->OnComponentAdded<T>(*this, component);
        return component;
    }

    struct TagComponent
    {
        std::string Tag;

        TagComponent() = default;
        TagComponent(const TagComponent& other) : Tag(other.Tag) {};
        TagComponent(const std::string tag) : Tag(tag) {}
    };

Sometimes it will throw "access violation exception" when _Container_base12::_Orphan_all() is called during reallocation.有时在重新分配期间调用 _Container_base12::_Orphan_all() 时会抛出“访问冲突异常”。 I find that the address for the two pointers in std::Container_proxy is weird.我发现 std::Container_proxy 中两个指针的地址很奇怪。 _Mycont should have one byte more for the address to make sense. _Mycont 应该多一个字节才能使地址有意义。 _Myfirstiter should not have the byte 0xfd at the front, it should be a nullptr. _Myfirstiter 前面不应该有字节 0xfd,它应该是一个 nullptr。

在此处输入图像描述

What's the possible reason?可能的原因是什么?

0xfd ? 0xfd ? I bet there are 4 bytes with that value, not one: What are the debug memory fill patterns in Visual Studio C++ and Windows?我敢打赌,该值有 4 个字节,而不是一个: Visual Studio C++ 和 Windows 中的调试 memory 填充模式是什么?

You're probabably looking at the remnants of a destroyed object.您可能正在查看被破坏的 object 的残余物。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 自定义 C++ 分配器导致错误:_Container_base12::_Orphan_all_unlocked_v3() - Custom C++ Allocator cause error in : _Container_base12::_Orphan_all_unlocked_v3() MSVC12 认为从 std::array 派生的聚合不是 pod - MSVC12 thinks aggregate derived from std::array is not pod 复制std :: string时的MSVC 12 std :: initializer_list错误 - MSVC 12 std::initializer_list bug when copying std::string 关于 MSVC std::experimental::generator 中的暂停恢复数据丢失 - Regarding the pause-resume data loss in MSVC std::experimental::generator `std::launder` 未返回 Clang 和 GCC 的正确数据,但适用于 msvc - `std::launder` not returning correct data for Clang and GCC but is for msvc MSVC2005 std :: _ Iterator_base ::调试时功能变慢 - MSVC2005 std::_Iterator_base:: functions slow while debugging MSVC: static 结构 std::atomic<bool> Test::g_test 有不同的类型</bool> - MSVC: static struct std::atomic<bool> Test::g_test has different type 如果使用/ std:c ++ 17在MSVC2017 15.9.3中使用静态本地错误,lambda返回的值是多少? - How is value returned by lambda using a static local wrong in MSVC2017 15.9.3 with /std:c++17? contains 不是 std::map MSVC 的成员 - contains is not a member of std::map MSVC 如果标准容器元素类型和std :: allocator类型不同,这是错误的吗? - Is it wrong if the standard container element type and std::allocator type are different?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM