You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The destructor for MemoryPoolAllocator does the following:
if (shared_->ownBuffer) {
baseAllocator_->Free(shared_);
}
When building with GNU 11.4.0 as identified by cmake, this emits -Werror=free-nonheap-object:
[ 98%] Building CXX object test/perftest/CMakeFiles/perftest.dir/schematest.cpp.o
In file included from /grmn/prj/fit/mon/FOC/external/rapidjson/include/rapidjson/document.h:20,
from /grmn/prj/fit/mon/FOC/external/rapidjson/include/rapidjson/schema.h:18,
from /grmn/prj/fit/mon/FOC/external/rapidjson/test/perftest/schematest.cpp:5:
In static member function ‘static void rapidjson::CrtAllocator::Free(void*)’,
inlined from ‘rapidjson::MemoryPoolAllocator<BaseAllocator>::~MemoryPoolAllocator() [with BaseAllocator = rapidjson::CrtAllocator]’ at /grmn/prj/fit/mon/FOC/external/rapidjson/include/rapidjson/allocators.h:271:33,
inlined from ‘rapidjson::MemoryPoolAllocator<BaseAllocator>::~MemoryPoolAllocator() [with BaseAllocator = rapidjson::CrtAllocator]’ at /grmn/prj/fit/mon/FOC/external/rapidjson/include/rapidjson/allocators.h:259:5,
inlined from ‘virtual void Schema::SetUp()’ at /grmn/prj/fit/mon/FOC/external/rapidjson/test/perftest/schematest.cpp:129:5:
/grmn/prj/fit/mon/FOC/external/rapidjson/include/rapidjson/rapidjson.h:715:38: error: ‘void free(void*)’ called on unallocated object ‘jsonBuffer’ [-Werror=free-nonheap-object]
715 | #define RAPIDJSON_FREE(ptr) std::free(ptr)
| ~~~~~~~~~^~~~~
/grmn/prj/fit/mon/FOC/external/rapidjson/include/rapidjson/allocators.h:100:54: note: in expansion of macro ‘RAPIDJSON_FREE’
100 | static void Free(void *ptr) RAPIDJSON_NOEXCEPT { RAPIDJSON_FREE(ptr); }
| ^~~~~~~~~~~~~~
/grmn/prj/fit/mon/FOC/external/rapidjson/test/perftest/schematest.cpp: In member function ‘virtual void Schema::SetUp()’:
/grmn/prj/fit/mon/FOC/external/rapidjson/test/perftest/schematest.cpp:90:14: note: declared here
90 | char jsonBuffer[65536];
| ^~~~~~~~~~
cc1plus: all warnings being treated as errors
This can be fixed by changing that block to: baseAllocator_->Free(shared_->ownBuffer ? shared_ : nullptr);
The text was updated successfully, but these errors were encountered:
This error comes from schematest.cpp line 129:
The destructor for MemoryPoolAllocator does the following:
When building with GNU 11.4.0 as identified by cmake, this emits -Werror=free-nonheap-object:
This can be fixed by changing that block to:
baseAllocator_->Free(shared_->ownBuffer ? shared_ : nullptr);
The text was updated successfully, but these errors were encountered: