SanderMertens / flecs

A fast entity component system (ECS) for C & C++
https://www.flecs.dev
Other
6.47k stars 454 forks source link

Memory leak when creating static flecs::world? #921

Closed cottonxray closed 1 year ago

cottonxray commented 1 year ago

Describe the bug Valgrind is reporting definitely lost blocks from creating a static flecs::world

To Reproduce example.cpp:

#include <flecs.h>

static flecs::world world;

auto main() -> int {
  return 0;
}

CMakeLists.txt:

cmake_minimum_required(VERSION 3.18.4)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
project(example)

find_package(flecs REQUIRED)

add_executable(example example.cpp)
target_link_libraries(example PRIVATE flecs::flecs)

Now, run:

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug ..
make -j
valgrind --leak-check=full ./example

Output is:

==145830== Memcheck, a memory error detector
==145830== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==145830== Using Valgrind-3.16.1 and LibVEX; rerun with -h for copyright info
==145830== Command: ./example
==145830== 
==145830== 
==145830== HEAP SUMMARY:
==145830==     in use at exit: 512 bytes in 35 blocks
==145830==   total heap usage: 1,576 allocs, 1,541 frees, 7,123,522 bytes allocated
==145830== 
==145830== 2 bytes in 1 blocks are definitely lost in loss record 1 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x12345D: flecs::_::cpp_type_impl<ecs_type_kind_t>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x11B9B8: flecs::_::cpp_type_impl<ecs_type_kind_t>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x112E29: flecs::component<ecs_type_kind_t>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10F279: flecs::component<ecs_type_kind_t> flecs::world::component<ecs_type_kind_t, char const (&) [23]>(char const (&) [23]) const (impl.hpp:12)
==145830==    by 0x10EA68: flecs::meta::_::init(flecs::world&) (impl.hpp:29)
==145830==    by 0x10EE48: flecs::world::init_builtin_components() (world.hpp:29)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830== 
==145830== 2 bytes in 1 blocks are definitely lost in loss record 2 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x12372D: flecs::_::cpp_type_impl<ecs_primitive_kind_t>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x11BEEB: flecs::_::cpp_type_impl<ecs_primitive_kind_t>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x11306F: flecs::component<ecs_primitive_kind_t>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10F2B5: flecs::component<ecs_primitive_kind_t> flecs::world::component<ecs_primitive_kind_t, char const (&) [28]>(char const (&) [28]) const (impl.hpp:12)
==145830==    by 0x10EA7B: flecs::meta::_::init(flecs::world&) (impl.hpp:30)
==145830==    by 0x10EE48: flecs::world::init_builtin_components() (world.hpp:29)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830== 
==145830== 2 bytes in 1 blocks are definitely lost in loss record 3 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x1239FD: flecs::_::cpp_type_impl<ecs_member_t>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x11C41E: flecs::_::cpp_type_impl<ecs_member_t>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x1132B5: flecs::component<ecs_member_t>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10F2F1: flecs::component<ecs_member_t> flecs::world::component<ecs_member_t, char const (&) [20]>(char const (&) [20]) const (impl.hpp:12)
==145830==    by 0x10EA8E: flecs::meta::_::init(flecs::world&) (impl.hpp:31)
==145830==    by 0x10EE48: flecs::world::init_builtin_components() (world.hpp:29)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830== 
==145830== 2 bytes in 1 blocks are definitely lost in loss record 4 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x123CAE: flecs::_::cpp_type_impl<ecs_enum_constant_t>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x11C951: flecs::_::cpp_type_impl<ecs_enum_constant_t>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x1134FB: flecs::component<ecs_enum_constant_t>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10F32D: flecs::component<ecs_enum_constant_t> flecs::world::component<ecs_enum_constant_t, char const (&) [27]>(char const (&) [27]) const (impl.hpp:12)
==145830==    by 0x10EAA1: flecs::meta::_::init(flecs::world&) (impl.hpp:32)
==145830==    by 0x10EE48: flecs::world::init_builtin_components() (world.hpp:29)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830== 
==145830== 2 bytes in 1 blocks are definitely lost in loss record 5 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x123F5F: flecs::_::cpp_type_impl<ecs_bitmask_constant_t>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x11CE84: flecs::_::cpp_type_impl<ecs_bitmask_constant_t>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x113741: flecs::component<ecs_bitmask_constant_t>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10F369: flecs::component<ecs_bitmask_constant_t> flecs::world::component<ecs_bitmask_constant_t, char const (&) [30]>(char const (&) [30]) const (impl.hpp:12)
==145830==    by 0x10EAB4: flecs::meta::_::init(flecs::world&) (impl.hpp:33)
==145830==    by 0x10EE48: flecs::world::init_builtin_components() (world.hpp:29)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830== 
==145830== 5 bytes in 1 blocks are definitely lost in loss record 6 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x12092F: flecs::_::cpp_type_impl<EcsPoly>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x115D28: flecs::_::cpp_type_impl<EcsPoly>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x115545: flecs::component<EcsPoly>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10FB93: flecs::component<EcsPoly> flecs::world::component<EcsPoly, char const (&) [18]>(char const (&) [18]) const (impl.hpp:12)
==145830==    by 0x10EE0C: flecs::world::init_builtin_components() (world.hpp:14)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830==    by 0x10E5F9: _GLOBAL__sub_I_main (example.cpp:7)
==145830== 
==145830== 10 bytes in 1 blocks are definitely lost in loss record 7 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x125798: flecs::_::cpp_type_impl<EcsComponent>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x11FE55: flecs::_::cpp_type_impl<EcsComponent>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x1150B9: flecs::component<EcsComponent>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10FB1B: flecs::component<EcsComponent> flecs::world::component<EcsComponent, char const (&) [23]>(char const (&) [23]) const (impl.hpp:12)
==145830==    by 0x10EDE6: flecs::world::init_builtin_components() (world.hpp:12)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830==    by 0x10E5F9: _GLOBAL__sub_I_main (example.cpp:7)
==145830== 
==145830== 11 bytes in 1 blocks are definitely lost in loss record 8 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x125A49: flecs::_::cpp_type_impl<EcsIdentifier>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x120388: flecs::_::cpp_type_impl<EcsIdentifier>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x1152FF: flecs::component<EcsIdentifier>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10FB57: flecs::component<EcsIdentifier> flecs::world::component<EcsIdentifier, char const (&) [24]>(char const (&) [24]) const (impl.hpp:12)
==145830==    by 0x10EDF9: flecs::world::init_builtin_components() (world.hpp:13)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830==    by 0x10E5F9: _GLOBAL__sub_I_main (example.cpp:7)
==145830== 
==145830== 14 bytes in 1 blocks are definitely lost in loss record 9 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x121EB7: flecs::_::cpp_type_impl<unsigned char>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x1185BA: flecs::_::cpp_type_impl<unsigned char>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x11176D: flecs::component<unsigned char>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10F021: flecs::component<unsigned char> flecs::world::component<unsigned char, char const (&) [16]>(char const (&) [16]) const (impl.hpp:12)
==145830==    by 0x10E9AA: flecs::meta::_::init(flecs::world&) (impl.hpp:18)
==145830==    by 0x10EE48: flecs::world::init_builtin_components() (world.hpp:29)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830== 
==145830== 14 bytes in 1 blocks are definitely lost in loss record 10 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x1226D9: flecs::_::cpp_type_impl<signed char>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x119A86: flecs::_::cpp_type_impl<signed char>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x112085: flecs::component<signed char>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10F111: flecs::component<signed char> flecs::world::component<signed char, char const (&) [16]>(char const (&) [16]) const (impl.hpp:12)
==145830==    by 0x10E9F6: flecs::meta::_::init(flecs::world&) (impl.hpp:22)
==145830==    by 0x10EE48: flecs::world::init_builtin_components() (world.hpp:29)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830== 
==145830== 15 bytes in 1 blocks are definitely lost in loss record 11 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x122168: flecs::_::cpp_type_impl<unsigned short>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x118AED: flecs::_::cpp_type_impl<unsigned short>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x1119B3: flecs::component<unsigned short>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10F05D: flecs::component<unsigned short> flecs::world::component<unsigned short, char const (&) [17]>(char const (&) [17]) const (impl.hpp:12)
==145830==    by 0x10E9BD: flecs::meta::_::init(flecs::world&) (impl.hpp:19)
==145830==    by 0x10EE48: flecs::world::init_builtin_components() (world.hpp:29)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830== 
==145830== 15 bytes in 1 blocks are definitely lost in loss record 12 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x122419: flecs::_::cpp_type_impl<unsigned int>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x119020: flecs::_::cpp_type_impl<unsigned int>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x111BF9: flecs::component<unsigned int>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10F099: flecs::component<unsigned int> flecs::world::component<unsigned int, char const (&) [17]>(char const (&) [17]) const (impl.hpp:12)
==145830==    by 0x10E9D0: flecs::meta::_::init(flecs::world&) (impl.hpp:20)
==145830==    by 0x10EE48: flecs::world::init_builtin_components() (world.hpp:29)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830== 
==145830== 15 bytes in 1 blocks are definitely lost in loss record 13 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x10FA32: flecs::_::cpp_type_impl<unsigned long>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x119553: flecs::_::cpp_type_impl<unsigned long>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x111E3F: flecs::component<unsigned long>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10F0D5: flecs::component<unsigned long> flecs::world::component<unsigned long, char const (&) [17]>(char const (&) [17]) const (impl.hpp:12)
==145830==    by 0x10E9E3: flecs::meta::_::init(flecs::world&) (impl.hpp:21)
==145830==    by 0x10EE48: flecs::world::init_builtin_components() (world.hpp:29)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830== 
==145830== 15 bytes in 1 blocks are definitely lost in loss record 14 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x12298A: flecs::_::cpp_type_impl<short>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x119FB9: flecs::_::cpp_type_impl<short>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x1122CB: flecs::component<short>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10F14D: flecs::component<short> flecs::world::component<short, char const (&) [17]>(char const (&) [17]) const (impl.hpp:12)
==145830==    by 0x10EA09: flecs::meta::_::init(flecs::world&) (impl.hpp:23)
==145830==    by 0x10EE48: flecs::world::init_builtin_components() (world.hpp:29)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830== 
==145830== 15 bytes in 1 blocks are definitely lost in loss record 15 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x122C3B: flecs::_::cpp_type_impl<int>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x11A4EC: flecs::_::cpp_type_impl<int>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x112511: flecs::component<int>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10F189: flecs::component<int> flecs::world::component<int, char const (&) [17]>(char const (&) [17]) const (impl.hpp:12)
==145830==    by 0x10EA1C: flecs::meta::_::init(flecs::world&) (impl.hpp:24)
==145830==    by 0x10EE48: flecs::world::init_builtin_components() (world.hpp:29)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830== 
==145830== 15 bytes in 1 blocks are definitely lost in loss record 16 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x10F7A3: flecs::_::cpp_type_impl<long>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x11AA1F: flecs::_::cpp_type_impl<long>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x112757: flecs::component<long>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10F1C5: flecs::component<long> flecs::world::component<long, char const (&) [17]>(char const (&) [17]) const (impl.hpp:12)
==145830==    by 0x10EA2F: flecs::meta::_::init(flecs::world&) (impl.hpp:25)
==145830==    by 0x10EE48: flecs::world::init_builtin_components() (world.hpp:29)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830== 
==145830== 15 bytes in 1 blocks are definitely lost in loss record 17 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x122EFB: flecs::_::cpp_type_impl<float>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x11AF52: flecs::_::cpp_type_impl<float>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x11299D: flecs::component<float>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10F201: flecs::component<float> flecs::world::component<float, char const (&) [17]>(char const (&) [17]) const (impl.hpp:12)
==145830==    by 0x10EA42: flecs::meta::_::init(flecs::world&) (impl.hpp:26)
==145830==    by 0x10EE48: flecs::world::init_builtin_components() (world.hpp:29)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830== 
==145830== 15 bytes in 1 blocks are definitely lost in loss record 18 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x1231AC: flecs::_::cpp_type_impl<double>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x11B485: flecs::_::cpp_type_impl<double>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x112BE3: flecs::component<double>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10F23D: flecs::component<double> flecs::world::component<double, char const (&) [17]>(char const (&) [17]) const (impl.hpp:12)
==145830==    by 0x10EA55: flecs::meta::_::init(flecs::world&) (impl.hpp:27)
==145830==    by 0x10EE48: flecs::world::init_builtin_components() (world.hpp:29)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830== 
==145830== 16 bytes in 1 blocks are definitely lost in loss record 19 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x1216A4: flecs::_::cpp_type_impl<EcsRest>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x117621: flecs::_::cpp_type_impl<EcsRest>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x11109B: flecs::component<EcsRest>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10EF6D: flecs::component<EcsRest> flecs::world::component<EcsRest, char const (&) [18]>(char const (&) [18]) const (impl.hpp:12)
==145830==    by 0x10E93F: flecs::rest::_::init(flecs::world&) (impl.hpp:13)
==145830==    by 0x10EE3C: flecs::world::init_builtin_components() (world.hpp:26)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830== 
==145830== 16 bytes in 1 blocks are definitely lost in loss record 20 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x121955: flecs::_::cpp_type_impl<bool>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x117B54: flecs::_::cpp_type_impl<bool>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x1112E1: flecs::component<bool>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10EFA9: flecs::component<bool> flecs::world::component<bool, char const (&) [18]>(char const (&) [18]) const (impl.hpp:12)
==145830==    by 0x10E984: flecs::meta::_::init(flecs::world&) (impl.hpp:16)
==145830==    by 0x10EE48: flecs::world::init_builtin_components() (world.hpp:29)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830== 
==145830== 16 bytes in 1 blocks are definitely lost in loss record 21 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x121C06: flecs::_::cpp_type_impl<char>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x118087: flecs::_::cpp_type_impl<char>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x111527: flecs::component<char>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10EFE5: flecs::component<char> flecs::world::component<char, char const (&) [18]>(char const (&) [18]) const (impl.hpp:12)
==145830==    by 0x10E997: flecs::meta::_::init(flecs::world&) (impl.hpp:17)
==145830==    by 0x10EE48: flecs::world::init_builtin_components() (world.hpp:29)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830== 
==145830== 16 bytes in 1 blocks are definitely lost in loss record 22 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x1157B7: flecs::_::cpp_type_impl<EcsEnum>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x10FDBF: flecs::_::cpp_type_impl<EcsEnum>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x114059: flecs::component<EcsEnum>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10F459: flecs::component<EcsEnum> flecs::world::component<EcsEnum, char const (&) [18]>(char const (&) [18]) const (impl.hpp:12)
==145830==    by 0x10EB00: flecs::meta::_::init(flecs::world&) (impl.hpp:38)
==145830==    by 0x10EE48: flecs::world::init_builtin_components() (world.hpp:29)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830== 
==145830== 16 bytes in 1 blocks are definitely lost in loss record 23 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x1254E7: flecs::_::cpp_type_impl<EcsUnit>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x11F922: flecs::_::cpp_type_impl<EcsUnit>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x114DFD: flecs::component<EcsUnit>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10F5C1: flecs::component<EcsUnit> flecs::world::component<EcsUnit, char const (&) [18]>(char const (&) [18]) const (impl.hpp:12)
==145830==    by 0x10EB72: flecs::meta::_::init(flecs::world&) (impl.hpp:45)
==145830==    by 0x10EE48: flecs::world::init_builtin_components() (world.hpp:29)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830== 
==145830== 17 bytes in 1 blocks are definitely lost in loss record 24 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x124F85: flecs::_::cpp_type_impl<EcsArray>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x11EEBC: flecs::_::cpp_type_impl<EcsArray>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x114971: flecs::component<EcsArray>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10F549: flecs::component<EcsArray> flecs::world::component<EcsArray, char const (&) [19]>(char const (&) [19]) const (impl.hpp:12)
==145830==    by 0x10EB4C: flecs::meta::_::init(flecs::world&) (impl.hpp:42)
==145830==    by 0x10EE48: flecs::world::init_builtin_components() (world.hpp:29)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830== 
==145830== 18 bytes in 1 blocks are definitely lost in loss record 25 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x121142: flecs::_::cpp_type_impl<EcsTimer>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x116BBB: flecs::_::cpp_type_impl<EcsTimer>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x110C0F: flecs::component<EcsTimer>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10EEF5: flecs::component<EcsTimer> flecs::world::component<EcsTimer, char const (&) [20]>(char const (&) [20]) const (impl.hpp:12)
==145830==    by 0x10E8FB: flecs::_::timer_init(flecs::world&) (impl.hpp:87)
==145830==    by 0x10EE24: flecs::world::init_builtin_components() (world.hpp:20)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830== 
==145830== 18 bytes in 1 blocks are definitely lost in loss record 26 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x124A23: flecs::_::cpp_type_impl<EcsMember>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x11E456: flecs::_::cpp_type_impl<EcsMember>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x1144E5: flecs::component<EcsMember>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10F4D1: flecs::component<EcsMember> flecs::world::component<EcsMember, char const (&) [20]>(char const (&) [20]) const (impl.hpp:12)
==145830==    by 0x10EB26: flecs::meta::_::init(flecs::world&) (impl.hpp:40)
==145830==    by 0x10EE48: flecs::world::init_builtin_components() (world.hpp:29)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830== 
==145830== 18 bytes in 1 blocks are definitely lost in loss record 27 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x124CD4: flecs::_::cpp_type_impl<EcsStruct>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x11E989: flecs::_::cpp_type_impl<EcsStruct>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x11472B: flecs::component<EcsStruct>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10F50D: flecs::component<EcsStruct> flecs::world::component<EcsStruct, char const (&) [20]>(char const (&) [20]) const (impl.hpp:12)
==145830==    by 0x10EB39: flecs::meta::_::init(flecs::world&) (impl.hpp:41)
==145830==    by 0x10EE48: flecs::world::init_builtin_components() (world.hpp:29)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830== 
==145830== 18 bytes in 1 blocks are definitely lost in loss record 28 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x125236: flecs::_::cpp_type_impl<EcsVector>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x11F3EF: flecs::_::cpp_type_impl<EcsVector>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x114BB7: flecs::component<EcsVector>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10F585: flecs::component<EcsVector> flecs::world::component<EcsVector, char const (&) [20]>(char const (&) [20]) const (impl.hpp:12)
==145830==    by 0x10EB5F: flecs::meta::_::init(flecs::world&) (impl.hpp:43)
==145830==    by 0x10EE48: flecs::world::init_builtin_components() (world.hpp:29)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830== 
==145830== 19 bytes in 1 blocks are definitely lost in loss record 29 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x115A68: flecs::_::cpp_type_impl<EcsBitmask>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x11026F: flecs::_::cpp_type_impl<EcsBitmask>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x11429F: flecs::component<EcsBitmask>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10F495: flecs::component<EcsBitmask> flecs::world::component<EcsBitmask, char const (&) [21]>(char const (&) [21]) const (impl.hpp:12)
==145830==    by 0x10EB13: flecs::meta::_::init(flecs::world&) (impl.hpp:39)
==145830==    by 0x10EE48: flecs::world::init_builtin_components() (world.hpp:29)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830== 
==145830== 20 bytes in 1 blocks are definitely lost in loss record 30 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x124210: flecs::_::cpp_type_impl<EcsMetaType>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x11D3B7: flecs::_::cpp_type_impl<EcsMetaType>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x113987: flecs::component<EcsMetaType>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10F3A5: flecs::component<EcsMetaType> flecs::world::component<EcsMetaType, char const (&) [22]>(char const (&) [22]) const (impl.hpp:12)
==145830==    by 0x10EAC7: flecs::meta::_::init(flecs::world&) (impl.hpp:35)
==145830==    by 0x10EE48: flecs::world::init_builtin_components() (world.hpp:29)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830== 
==145830== 21 bytes in 1 blocks are definitely lost in loss record 31 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x124772: flecs::_::cpp_type_impl<EcsPrimitive>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x11DE1D: flecs::_::cpp_type_impl<EcsPrimitive>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x113E13: flecs::component<EcsPrimitive>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10F41D: flecs::component<EcsPrimitive> flecs::world::component<EcsPrimitive, char const (&) [23]>(char const (&) [23]) const (impl.hpp:12)
==145830==    by 0x10EAED: flecs::meta::_::init(flecs::world&) (impl.hpp:37)
==145830==    by 0x10EE48: flecs::world::init_builtin_components() (world.hpp:29)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830== 
==145830== 22 bytes in 1 blocks are definitely lost in loss record 32 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x1213F3: flecs::_::cpp_type_impl<EcsDocDescription>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x1170EE: flecs::_::cpp_type_impl<EcsDocDescription>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x110E55: flecs::component<EcsDocDescription>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10EF31: flecs::component<EcsDocDescription> flecs::world::component<EcsDocDescription, char const (&) [24]>(char const (&) [24]) const (impl.hpp:12)
==145830==    by 0x10E91D: flecs::doc::_::init(flecs::world&) (impl.hpp:46)
==145830==    by 0x10EE30: flecs::world::init_builtin_components() (world.hpp:23)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830== 
==145830== 23 bytes in 1 blocks are definitely lost in loss record 33 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x120E91: flecs::_::cpp_type_impl<EcsRateFilter>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x116688: flecs::_::cpp_type_impl<EcsRateFilter>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x1109C9: flecs::component<EcsRateFilter>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10EEB9: flecs::component<EcsRateFilter> flecs::world::component<EcsRateFilter, char const (&) [25]>(char const (&) [25]) const (impl.hpp:12)
==145830==    by 0x10E8E8: flecs::_::timer_init(flecs::world&) (impl.hpp:86)
==145830==    by 0x10EE24: flecs::world::init_builtin_components() (world.hpp:20)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830== 
==145830== 24 bytes in 1 blocks are definitely lost in loss record 34 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x120BE0: flecs::_::cpp_type_impl<EcsTickSource>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x116155: flecs::_::cpp_type_impl<EcsTickSource>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x110783: flecs::component<EcsTickSource>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10EE7D: flecs::component<EcsTickSource> flecs::world::component<EcsTickSource, char const (&) [26]>(char const (&) [26]) const (impl.hpp:12)
==145830==    by 0x10E8C6: flecs::_::system_init(flecs::world&) (impl.hpp:138)
==145830==    by 0x10EE18: flecs::world::init_builtin_components() (world.hpp:17)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830== 
==145830== 30 bytes in 1 blocks are definitely lost in loss record 35 of 35
==145830==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==145830==    by 0x48E8AE9: ecs_os_api_malloc (in /usr/local/lib/libflecs.so)
==145830==    by 0x48B8FD1: ecs_strbuf_get (in /usr/local/lib/libflecs.so)
==145830==    by 0x48D7DB8: ecs_get_path_w_sep (in /usr/local/lib/libflecs.so)
==145830==    by 0x1244C1: flecs::_::cpp_type_impl<EcsMetaTypeSerialized>::init(ecs_world_t*, unsigned long, bool) (component.hpp:151)
==145830==    by 0x11D8EA: flecs::_::cpp_type_impl<EcsMetaTypeSerialized>::id_explicit(ecs_world_t*, char const*, bool, unsigned long, bool, bool*) (component.hpp:182)
==145830==    by 0x113BCD: flecs::component<EcsMetaTypeSerialized>::component(ecs_world_t*, char const*, bool, unsigned long) (component.hpp:431)
==145830==    by 0x10F3E1: flecs::component<EcsMetaTypeSerialized> flecs::world::component<EcsMetaTypeSerialized, char const (&) [32]>(char const (&) [32]) const (impl.hpp:12)
==145830==    by 0x10EADA: flecs::meta::_::init(flecs::world&) (impl.hpp:36)
==145830==    by 0x10EE48: flecs::world::init_builtin_components() (world.hpp:29)
==145830==    by 0x10E7B1: flecs::world::world() (world.hpp:118)
==145830==    by 0x10C2AB: __static_initialization_and_destruction_0(int, int) (example.cpp:3)
==145830== 
==145830== LEAK SUMMARY:
==145830==    definitely lost: 512 bytes in 35 blocks
==145830==    indirectly lost: 0 bytes in 0 blocks
==145830==      possibly lost: 0 bytes in 0 blocks
==145830==    still reachable: 0 bytes in 0 blocks
==145830==         suppressed: 0 bytes in 0 blocks
==145830== 
==145830== For lists of detected and suppressed errors, rerun with: -s
==145830== ERROR SUMMARY: 35 errors from 35 contexts (suppressed: 0 from 0)

Expected behavior I would expect Valgrind to report no leaks in this situation, although I'm certainly open to the suggestion that this is a false positive from Valgrind, or that I've done something wrong :)

Additional context Operating system: Debian GNU/Linux 11 (bullseye) Compiler: g++ (Debian 10.2.1-6) 10.2.1 20210110 Architecture: amd64 flecs version: a8caba8e77a016d980007854188577ffcf74370b

Extra note Just wanted to say - thanks for writing this library! It's a real joy to use. Let me know if there's anything I can do to help.

SanderMertens commented 1 year ago

Thanks for letting me know! I reproduced it, but haven't figured out what's causing it yet 🤔 It has something to do with the static strings that are allocated by the world, but for some reason aren't cleaned up when the world is a global variable.

Will check back in if I know more!

SanderMertens commented 1 year ago

Fixed! The issue was caused by undefined construction order of global variables. What happened was:

Fortunately the string was redundant (I should've removed it a long time ago), so removing it fixed the issue :)