Description
Issue Description
When running the MGARD library with AddressSanitizer enabled, a new-delete-type-mismatch error occurs during memory deallocation in the mgard::compress function. The error indicates a mismatch between the type of memory allocation and deallocation, specifically involving aligned memory allocation.
Issue details
`==3438607==ERROR: AddressSanitizer: new-delete-type-mismatch on 0x602000000d90 in thread T0:
object passed to delete has wrong type:
alignment of the allocated type: 8 bytes;
alignment of the deallocated type: default-aligned.
#0 0x7f49edca5e57 in operator delete ../../../../src/libsanitizer/asan/asan_new_delete.cpp:163
#1 0x55b2f49cbeb8 in std::enable_if<std::is_convertible<unsigned char () [], unsigned char () []>::value, void>::type std::default_delete<unsigned char []>::operator()(unsigned char*) const /usr/include/c++/11/bits/unique_ptr.h:120
#2 0x55b2f4985c19 in std::unique_ptr<unsigned char [], std::default_delete<unsigned char []> >::~unique_ptr() /usr/include/c++/11/bits/unique_ptr.h:612
#3 0x55b2f496f955 in mgard::MemoryBuffer::~MemoryBuffer() /root/MGARD/include/utilities.hpp:421
#4 0x7f49de48e94c in mgard::compress(mgard::pb::Header const&, void*, unsigned long) /root/MGARD/src/compressors.cpp:654
#5 0x55b2f4971cd4 in mgard::CompressedDataset<2ul, float> mgard::compress<2ul, float>(mgard::TensorMeshHierarchy<2ul, float> const&, float*, float, float) /root/MGARD/include/compress.tpp:58
#6 0x55b2f495c325 in int launch_compress(unsigned char, mgard_x::data_type, char const*, char const*, std::vector<unsigned long, std::allocator >, float, float, mgard_x::error_bound_type, bool) /root/MGARD/src/mgard-x/Executables/MgardSerialExec.cpp:317
#7 0x55b2f491f1f2 in try_compression(int, char**) /root/MGARD/src/mgard-x/Executables/MgardSerialExec.cpp:554
#8 0x55b2f4921f6b in main /root/MGARD/src/mgard-x/Executables/MgardSerialExec.cpp:622
#9 0x7f49d41c9d8f (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
#10 0x7f49d41c9e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f)
#11 0x55b2f491a464 in _start (/root/MGARD/build/bin/mgard-cpu+0x41a464)
0x602000000d90 is located 0 bytes inside of 8-byte region [0x602000000d90,0x602000000d98)
allocated by thread T0 here:
#0 0x7f49edca58f7 in operator new[](unsigned long, std::align_val_t) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:114
#1 0x7f49de49d140 in mgard::quantization_buffer(mgard::pb::Header const&, unsigned long) /root/MGARD/src/format.cpp:86
#2 0x7f49de48e910 in mgard::compress(mgard::pb::Header const&, void*, unsigned long) /root/MGARD/src/compressors.cpp:654
#3 0x55b2f4971cd4 in mgard::CompressedDataset<2ul, float> mgard::compress<2ul, float>(mgard::TensorMeshHierarchy<2ul, float> const&, float*, float, float) /root/MGARD/include/compress.tpp:58
#4 0x55b2f495c325 in int launch_compress(unsigned char, mgard_x::data_type, char const*, char const*, std::vector<unsigned long, std::allocator >, float, float, mgard_x::error_bound_type, bool) /root/MGARD/src/mgard-x/Executables/MgardSerialExec.cpp:317
#5 0x55b2f491f1f2 in try_compression(int, char**) /root/MGARD/src/mgard-x/Executables/MgardSerialExec.cpp:554
#6 0x55b2f4921f6b in main /root/MGARD/src/mgard-x/Executables/MgardSerialExec.cpp:622
#7 0x7f49d41c9d8f (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)`
Enviroment details
Compiler: GCC 11
OS: Ubuntu 20.04
Sanitizer: AddressSanitizer
MGARD Version: [Specify version/commit]