-
Notifications
You must be signed in to change notification settings - Fork 81
Dynamic memory management #198
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
Conversation
Reviewer's Guide by SourceryThis pull request migrates the PSLab firmware to use dynamic memory allocation. This change replaces the previous static memory allocation scheme with malloc/free-based management. The changes include modifications to the wave generator, interval capture, oscilloscope, and other modules to use dynamic memory allocation. Additionally, the pull request updates the command functions to use dynamically allocated memory for return values and updates the packet handler to free the allocated memory after sending the response. The buffer module was removed, and a heap size was added to the linker flags. Finally, an ESP01 target was added. No diagrams generated as the changes look simple and do not need a visual representation. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We encountered an error and are unable to review this PR. We have been notified and are working to fix it.
You can try again by commenting this pull request with @sourcery-ai review
, or contact us for help.
@sourcery-ai review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @bessman - I've reviewed your changes - here's some feedback:
Overall Comments:
- The function signatures have changed to pass arguments by double pointer, but some functions still copy the arguments into local variables, which is unnecessary.
- Consider adding error handling for when malloc returns NULL in functions that allocate memory.
- It looks like the buffer.c and buffer.h files were removed, but there are still references to BUFFER_sample_buffer that need to be removed.
Here's what I looked at during the review
- 🟡 General issues: 3 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
@sourcery-ai summary |
@sourcery-ai Provide an example from the code of what you mean by this, with an explanation of why you think it is unnecessary. |
This pull request adds heap based memory management. The previous memory management, which was based on large, statically allocated buffers, is replaced with malloc/free-based management.
Increases sample depth of the oscilloscope and logic analyzer by allowing the user to use more memory than was previously possible.
Summary by Sourcery
Replace static memory management with dynamic memory allocation using malloc/free, enabling more flexible memory usage across the firmware
New Features:
Enhancements:
Build: