Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

valgrind warnings #33

Open
dcooley opened this issue Oct 9, 2023 · 1 comment
Open

valgrind warnings #33

dcooley opened this issue Oct 9, 2023 · 1 comment

Comments

@dcooley
Copy link
Contributor

dcooley commented Oct 9, 2023

solved by this pr, included in h3 v4.1.0

But...

  • compactCells
  • uncompactCells
  • gridRingUnsafe
  • cellsToMultiLinkedPolygon

Valigrind check commands

  • R CMD build h3r
  • R CMD check h3r_0.1.1.tar.gz
  • cd h3r.Rcheck
  • R -d "valgrind --track-origins=yes --tool=memcheck --leak-check=full" --vanilla < h3r-Ex.R > R_output.txt 2> valgrind.txt

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 added a commit that referenced this issue Mar 11, 2024
dcooley pushed a commit that referenced this issue Mar 11, 2024
@dcooley
Copy link
Contributor Author

dcooley commented Mar 11, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant