google / google/shaderc

Memory leak in shaderc_compiler_initialize

Open
#1,473 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.2k
Forks
445
Avg merge
11h 6m
Merged PRs (30d)
6

Description

_shaderc_compiler_initialize_ leaks 80 bytes.

This leak only happens once regardless of how many times _shaderc_compiler_initialize_ is called, so is likely a global object/singleton. In any case, singletons should be deleted when there are no longer any references (i.e. when the last _shaderc_compiler_t_ object is released).

I am using the debug build of shaderc for included with the latest Vulkan SDK version 1.4.304 (released 13 Jan 2025), built for 64 bit Windows using Microsoft Visual Studio Community 2022.

Code:

shaderc_compiler_t shaderCompiler = shaderc_compiler_initialize();
shaderc_compiler_release(shaderCompiler);

I have not seen the shaderc code myself as I'm using pre-built libraries, but the shaderc library appears to link automatically with my project's memory management (overriden _operator new_), which is how this leak was discovered.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.