Skip to content

Cleanup global statics that use heap allocation #655

@skallweitNV

Description

@skallweitNV

We should try to avoid using statics that use heap allocation.

A quick search revealed these places using statics with potential heap allocations:

13 results - 11 files

src\aftermath.cpp:
  271:     static RefPtr<AftermathCrashDumper> instance = new AftermathCrashDumper();

src\device.cpp:
  554:     static const std::unordered_map<std::string_view, Feature> kFeatureNameMap = {
  611:     static const std::unordered_map<std::string_view, Capability> kCapabilityMap = {

src\rhi.cpp:
  159:         static RHI instance;

src\core\block-allocator.h:
  186:     static ::rhi::BlockAllocator<ClassName> s_allocator;

src\core\reverse-map.h:
  13:     static std::unordered_map<To, From> reverseMap = [&]()

src\core\smart-pointer.h:
   38:         static RefObjectTracker tracker;
  164:     static uint64_t getObjectCount() { return s_objectCount.load(); }

src\core\task-pool.cpp:
  81: static ComPtr<ITaskPool> s_globalTaskPool;

src\cuda\cuda-surface.cpp:
  112: static auto translateVkFormat = reverseMap<Format, VkFormat>(vk::getVkFormat, Format::Undefined, Format::_Count);

src\d3d\d3d-utils.cpp:
  324:     static ComPtr<IDXGIFactory> factory = []()

src\vulkan\vk-surface.cpp:
  16: static auto translateVkFormat = reverseMap<Format, VkFormat>(getVkFormat, Format::Undefined, Format::_Count);

src\wgpu\wgpu-surface.cpp:
  14: static auto translateWGPUFormat =

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions