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

Fix a valgrind UMR concerning optimised line rendering #217

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nigels-com
Copy link
Contributor

valgrind warning is seen for first call to render_line
I didn't quite pinpoint the root cause.
memset resolves the warning, possibly faster than the loop?

Before:

==27458== Use of uninitialised value of size 8
==27458==    at 0x1133CB: render_line (video.c:761)
==27458==    by 0x123EA7: video_step (video.c:797)
==27458==    by 0x128695: emulator_loop (main.c:919)
==27458==    by 0x10EC31: main (main.c:788)

After:

==27041== Memcheck, a memory error detector
==27041== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==27041== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==27041== Command: ./x16emu -rom rom.bin -scale 2 -prg petdrawx16.prg
==27041== 
==27041== 
==27041== HEAP SUMMARY:
==27041==     in use at exit: 631,731 bytes in 560 blocks
==27041==   total heap usage: 40,095 allocs, 39,535 frees, 455,145,124 bytes allocated
==27041== 
==27041== LEAK SUMMARY:
==27041==    definitely lost: 8,376 bytes in 6 blocks
==27041==    indirectly lost: 1,728 bytes in 38 blocks
==27041==      possibly lost: 0 bytes in 0 blocks
==27041==    still reachable: 621,627 bytes in 516 blocks
==27041==         suppressed: 0 bytes in 0 blocks
==27041== Rerun with --leak-check=full to see details of leaked memory
==27041== 
==27041== For counts of detected and suppressed errors, rerun with: -v
==27041== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 5 from 1)
``

@nigels-com
Copy link
Contributor Author

@neilogd I noted your optimisation effort in the recent history, possibly the logic here is clear to you and the specific corner case might be obvious!

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

Successfully merging this pull request may close these issues.

1 participant