Skip to content

[DOC] I believe that the TCP/IP stack can use static allocations, contrary to a statement in the tutorial #951

New issue

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

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

Already on GitHub? # to your account

Closed
omarandlorraine opened this issue Mar 7, 2023 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@omarandlorraine
Copy link

Describe the issue

The page titled Adding the TCP/IP Source Files to an RTOS Project contains this statement

The application must be using the heap_4 or heap_5 memory allocator.

Further reading seems to suggest that this is only the case when using BufferAllocation_2.c. A page titled TCP/IP Stack Network Buffers Allocation Schemes explains that allocation scheme 1 uses static allocations and scheme 2 uses dynamic allocations.

I'm also left wondering precisely why heaps 1, 2 and 3 do not satisfy the requirements of BufferAllocation_2.c. I suppose this allocation scheme benefits from free-space coalescence, but that's a guess. It is possible that the above statement was written before there was the option of using static memory allocation, and is now out of date. This could suggest that the TCP/IP stack also does not strictly require free-space coalescence.

Could I ask that the documentation around this is revised?

Reference
Adding the TCP/IP Source Files to an RTOS Project

TCP/IP Stack Network Buffers Allocation Schemes

Screenshot
If applicable, please attach screenshot.

Browser

  • Browser: Firefox
  • Version: I don't know
@omarandlorraine omarandlorraine added the documentation Improvements or additions to documentation label Mar 7, 2023
@omarandlorraine
Copy link
Author

I have discovered a related issue in FreeRTOS+TCP. In a nutshell, with dynamic allocations disabled, the build fails due to calls to pvPortMalloc.

@paulbartell
Copy link
Contributor

paulbartell commented Mar 10, 2023

@omarandlorraine Indeed. Dynamic allocation is currently required for FreeRTOS+TCP. Until this is addressed in the library, one alternative to a traditional heap allocator would be to use a memory-pool based allocator which can ensure that heap fragmentation does not occur.

BufferAllocation_1 indeed allows one to statically allocate packet buffers but this is not the only type of memory needed by the FreeRTOS+TCP stack.

@paulbartell paulbartell closed this as not planned Won't fix, can't repro, duplicate, stale Mar 10, 2023
moninom1 added a commit to moninom1/FreeRTOS that referenced this issue Jul 7, 2023
every-breaking-wave pushed a commit to every-breaking-wave/FreeRTOS that referenced this issue Nov 15, 2024
Co-authored-by: Soren Ptak <ptaksoren@gmail.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants