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

DMA capable memory decreasing over time #42

Closed
2 tasks done
finger563 opened this issue Dec 4, 2023 · 1 comment · Fixed by #52
Closed
2 tasks done

DMA capable memory decreasing over time #42

finger563 opened this issue Dec 4, 2023 · 1 comment · Fixed by #52
Labels
bug Something isn't working emulation gameboy color gameboy hal hardware abstraction layer memory NES

Comments

@finger563
Copy link
Contributor

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

What is the expected behavior?

We do not leak memory and do not run out of DMA-capable memory (needed for LCD SPI).

What is the actual behavior?

Running Nofrendo (NES) emluation seems to decrease DMA-capable memory:

CleanShot 2023-12-04 at 11 20 33

Steps to reproduce.

  1. Run GBC rom
  2. Run NES rom
  3. Run another NES rom
  4. Run GBC rom
  5. Run another GBC rom

See that DMA decreases between steps 1->2 and steps 2->3, but not 3->4 or 4->5.

Build or installation Logs.

No response

More Information.

This may be related to nofrendo itself (and the modiciations I've made to it), or it could be more general and associated with one of the following:

  1. How the screen is communicated with (e.g. emulators use DMA capable memory, but the menu/gui and clearing commands use non-dma capable memory)
  2. Somewhere in the emulator(s) which is using stack that's not clearing for some reason
  3. Somewhere in the emulator(s) which are using mallocs but not freeing the memory
  4. Perhaps the internal allocation of dma-capable memory in the spi transaction in ESP-IDF is leaking memory during the cases when non-dma capable memory is being passed in?

I don't have hard data for it yet, but I believe the memory leak is worse when the steps include loading save states in the emulators.
6. Something else entirely?

@finger563 finger563 added bug Something isn't working memory gameboy gameboy color NES emulation hal hardware abstraction layer labels Dec 4, 2023
@finger563
Copy link
Contributor Author

I've added some logging to spi_master.c and seen that there are cases where it is attempting to free memory that was not allocated. This happens during a timeout when trying to get the trans_result. Possibly related ESP-IDF issue here: espressif/esp-idf#10066

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working emulation gameboy color gameboy hal hardware abstraction layer memory NES
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant