ifcquery/ifcplusplus

Bus error (core dumped)

Marcus-D-Forte opened this issue · 1 comments

Simply by running the CreateWallAndWriteFile example after compilation in Ubuntu 22, this is the output:
Bus error (core dumped)

By running valgrind (Release build type, since Debug broke for me):

==98994== Memcheck, a memory error detector
==98994== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==98994== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==98994== Command: Release/CreateWallAndWriteFile
==98994== 
==98994== Invalid read of size 4
==98994==    at 0x510AEEE: UnitConverter::resetUnitFactors() (in /home/marcus/workspace/cpp/ifcplusplus/build/Release/libIfcPlusPlus.so)
==98994==    by 0x11CC7B: main (in /home/marcus/workspace/cpp/ifcplusplus/build/Release/CreateWallAndWriteFile)
==98994==  Address 0x3ff0000000000008 is not stack'd, malloc'd or (recently) free'd
==98994== 
==98994== 
==98994== Process terminating with default action of signal 11 (SIGSEGV)
==98994==  General Protection Fault
==98994==    at 0x510AEEE: UnitConverter::resetUnitFactors() (in /home/marcus/workspace/cpp/ifcplusplus/build/Release/libIfcPlusPlus.so)
==98994==    by 0x11CC7B: main (in /home/marcus/workspace/cpp/ifcplusplus/build/Release/CreateWallAndWriteFile)
==98994== 
==98994== HEAP SUMMARY:
==98994==     in use at exit: 290,295 bytes in 2,220 blocks
==98994==   total heap usage: 4,426 allocs, 2,206 frees, 508,475 bytes allocated
==98994== 
==98994== LEAK SUMMARY:
==98994==    definitely lost: 0 bytes in 0 blocks
==98994==    indirectly lost: 0 bytes in 0 blocks
==98994==      possibly lost: 0 bytes in 0 blocks
==98994==    still reachable: 290,295 bytes in 2,220 blocks
==98994==         suppressed: 0 bytes in 0 blocks
==98994== Rerun with --leak-check=full to see details of leaked memory
==98994== 
==98994== For lists of detected and suppressed errors, rerun with: -s
==98994== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Segmentation fault (core dumped)

Moreover, simply by commenting line 167 on /examples/CreateWallAndWriteFile/src/main.cpp:
// ifc_model->getUnitConverter()->setLengthInMeterFactor(unit_length_factor);

Makes the example work without memory leaks. I have investigated little and yet found no solution.

This issue is resolved with latest update