GPUOpen-Tools / compressonator

Tool suite for Texture and 3D Model Compression, Optimization and Analysis using CPUs, GPUs and APUs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Some memory leaks detected

Flone-dnb opened this issue · comments

I've wrote some code that pretty much looks like framework_example2.cpp and address sanitizer found some memory leaks:

=================================================================
==30552==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 2560 byte(s) in 8 object(s) allocated from:
    #0 0x5615e5ec9b32 in operator new[](unsigned long)
    #1 0x5615e71fdd46 in CCPU_HPC::Init() /compressonator/applications/_plugins/ccmp_encode/hpc/compute_cpu_hpc.cpp:256:32
    #2 0x5615e71fdfeb in CCPU_HPC::CCPU_HPC(void*) /compressonator/applications/_plugins/ccmp_encode/hpc/compute_cpu_hpc.cpp:271:5
    #3 0x5615e71fcfa4 in Plugin_CCPU_HPC::TC_Init(void*) /compressonator/applications/_plugins/ccmp_encode/hpc/ccpu_hpc.cpp:69:42
    #4 0x5615e71c93f4 in CMP_CreateComputeLibrary /compressonator/cmp_framework/compute_base.cpp:306:28
    #5 0x5615e71ca756 in CMP_ProcessTexture /compressonator/cmp_framework/compute_base.cpp:828:17

Direct leak of 576 byte(s) in 8 object(s) allocated from:
    #0 0x5615e5ec9b32 in operator new[](unsigned long) (/home/flone/prog/cpp/nameless-engine/build/OUTPUT/editor/editor+0x267b32) (BuildId: 7f224469060b207ce4f6ad3c63f4cac3072bb1e8)
    #1 0x5615e71fde09 in CCPU_HPC::Init() /compressonator/applications/_plugins/ccmp_encode/hpc/compute_cpu_hpc.cpp:257:32
    #2 0x5615e71fdfeb in CCPU_HPC::CCPU_HPC(void*) /compressonator/applications/_plugins/ccmp_encode/hpc/compute_cpu_hpc.cpp:271:5
    #3 0x5615e71fcfa4 in Plugin_CCPU_HPC::TC_Init(void*) /compressonator/applications/_plugins/ccmp_encode/hpc/ccpu_hpc.cpp:69:42
    #4 0x5615e71c93f4 in CMP_CreateComputeLibrary /compressonator/cmp_framework/compute_base.cpp:306:28
    #5 0x5615e71ca756 in CMP_ProcessTexture /compressonator/cmp_framework/compute_base.cpp:828:17

Direct leak of 128 byte(s) in 1 object(s) allocated from:
    #0 0x5615e5ec9b32 in operator new[](unsigned long) (/home/flone/prog/cpp/nameless-engine/build/OUTPUT/editor/editor+0x267b32) (BuildId: 7f224469060b207ce4f6ad3c63f4cac3072bb1e8)
    #1 0x5615e724a51b in Plugin_KTX::TC_PluginFileSaveTexture(char const*, CMP_MipSet*) /compressonator/applications/_plugins/cimage/ktx/ktx1.cpp:973:32
    #2 0x5615e71cb65b in CMP_SaveTexture /compressonator/cmp_framework/compute_base.cpp:1078:27

Direct leak of 48 byte(s) in 2 object(s) allocated from:
    #0 0x5615e5e82101 in __interceptor_calloc (/home/flone/prog/cpp/nameless-engine/build/OUTPUT/editor/editor+0x220101) (BuildId: 7f224469060b207ce4f6ad3c63f4cac3072bb1e8)
    #1 0x5615e71c3f87 in CMP_CMIPS::AllocateAllMipLevels(CMP_MipLevel**, CMP_TextureType, int) /compressonator/cmp_framework/common/cmp_mips.cpp:947:61
    #2 0x5615e71c16b1 in CMP_CMIPS::AllocateMipSet(CMP_MipSet*, CMP_ChannelFormat, CMP_TextureDataType, CMP_TextureType, int, int, int) /compressonator/cmp_framework/common/cmp_mips.cpp:1005:10
    #3 0x5615e71ca478 in CMP_ProcessTexture /compressonator/cmp_framework/compute_base.cpp:755:16

Direct leak of 48 byte(s) in 2 object(s) allocated from:
    #0 0x5615e5e82101 in __interceptor_calloc (/home/flone/prog/cpp/nameless-engine/build/OUTPUT/editor/editor+0x220101) (BuildId: 7f224469060b207ce4f6ad3c63f4cac3072bb1e8)
    #1 0x5615e71c3f87 in CMP_CMIPS::AllocateAllMipLevels(CMP_MipLevel**, CMP_TextureType, int) /compressonator/cmp_framework/common/cmp_mips.cpp:947:61
    #2 0x5615e71c16b1 in CMP_CMIPS::AllocateMipSet(CMP_MipSet*, CMP_ChannelFormat, CMP_TextureDataType, CMP_TextureType, int, int, int) /compressonator/cmp_framework/common/cmp_mips.cpp:1005:10
    #3 0x5615e71cae08 in stb_load(char const*, CMP_MipSet*) /compressonator/cmp_framework/compute_base.cpp:954:16
    #4 0x5615e71cb354 in CMP_LoadTexture /compressonator/cmp_framework/compute_base.cpp:1039:18

SUMMARY: AddressSanitizer: 3360 byte(s) leaked in 21 allocation(s).

I hope you can fix them.

@Flone-dnb Thanks for the report! We'll be looking into this in the near future.