SymbolixAU / h3r

R-interface to {h3lib}
https://symbolixau.github.io/h3r/
Other
5 stars 0 forks source link

valgrind warnings #33

Open dcooley opened 11 months ago

dcooley commented 11 months ago

solved by this pr, included in h3 v4.1.0

But...

Valigrind check commands

outputs to h3r.Rcheck/valgrind.text with results of valgrind check

e.g

==27558== Conditional jump or move depends on uninitialised value(s)
==27558==    at 0x10CCBA37: isValidCell (h3Index.c:93)
==27558==    by 0x10CE1712: isValidCell (h3libapi.h:403)
==27558==    by 0x10CE1712: h3rCompactCells (h3rHierarchy.c:211)
==27558==    by 0x49562DD: ??? (in /usr/lib/R/lib/libR.so)
==27558==    by 0x4999272: ??? (in /usr/lib/R/lib/libR.so)
==27558==    by 0x49ADCFF: Rf_eval (in /usr/lib/R/lib/libR.so)
==27558==    by 0x49AFD95: ??? (in /usr/lib/R/lib/libR.so)
==27558==    by 0x49B0BC4: Rf_applyClosure (in /usr/lib/R/lib/libR.so)
==27558==    by 0x49ADE2B: Rf_eval (in /usr/lib/R/lib/libR.so)
==27558==    by 0x49E3D19: Rf_ReplIteration (in /usr/lib/R/lib/libR.so)
==27558==    by 0x49E40AF: ??? (in /usr/lib/R/lib/libR.so)
==27558==    by 0x49E416F: run_Rmainloop (in /usr/lib/R/lib/libR.so)
==27558==    by 0x10909E: main (in /usr/lib/R/bin/exec/R)
==27558==  Uninitialised value was created by a stack allocation
==27558==    at 0x10CE15C4: h3rCompactCells (h3rHierarchy.c:197)

I think the compactedSet needs checking that each element has been assigned / initialised, before it is accessed

same goes for result

dcooley commented 6 months ago

I've use memest(cellSet, -1, sizeof(cellSet) whenever something like H3Index cellSet[setSize] is declared. This has removed 95% of the Valgrind warnings.

The remaining one is caused by cellsToMultipolygon(). I can't figure this out so have removed this function for v1.1