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

logic of CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL doesn't match its document (IDFGH-12318) #13353

Closed
3 tasks done
yyjdelete opened this issue Mar 11, 2024 · 1 comment
Closed
3 tasks done
Assignees
Labels
Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally

Comments

@yyjdelete
Copy link

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

The document says

if (size < threshold) //use internal RAM
else //use external RAM

but the code use <= instead, so which one is wrong and what's the expected behavior?

- When allocating a size less than the threshold, the allocator will try internal memory first.
- When allocating a size equal to or larger than the threshold, the allocator will try external memory first.

if (size <= (size_t)malloc_alwaysinternal_limit) {
r=heap_caps_malloc_base( size, MALLOC_CAP_DEFAULT | MALLOC_CAP_INTERNAL );
} else {
r=heap_caps_malloc_base( size, MALLOC_CAP_DEFAULT | MALLOC_CAP_SPIRAM );
}

@espressif-bot espressif-bot added the Status: Opened Issue is new label Mar 11, 2024
@github-actions github-actions bot changed the title logic of CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL doesn't match its document logic of CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL doesn't match its document (IDFGH-12318) Mar 11, 2024
@0xjakob
Copy link
Collaborator

0xjakob commented Mar 11, 2024

@yyjdelete We've created a fix for this which will be available on master soon, thanks for noticing!

@espressif-bot espressif-bot added Status: Reviewing Issue is being reviewed Status: Done Issue is done internally Resolution: NA Issue resolution is unavailable and removed Status: Opened Issue is new Status: Reviewing Issue is being reviewed labels Mar 11, 2024
DarkZeros pushed a commit to DarkZeros/esp-idf that referenced this issue May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally
Projects
None yet
Development

No branches or pull requests

3 participants