# Converting FreeRTOS labs TCP stack to FreeRTOS

**URL:** <https://forums.freertos.org/t/converting-freertos-labs-tcp-stack-to-freertos/4038>\
**Category:** Kernel\
**Created:** [August 24, 2015, 7:16pm UTC](https://forums.freertos.org/t/converting-freertos-labs-tcp-stack-to-freertos/4038 "2015-08-24T19:16:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [August 24, 2015, 7:16pm UTC](https://forums.freertos.org/t/converting-freertos-labs-tcp-stack-to-freertos/4038/1 "2015-08-24T19:16:01Z")

</div>

**[lciummo](https://sourceforge.net/u/lciummo/)** wrote on [Monday, August 24, 2015](https://sourceforge.net/p/freertos/discussion/382005/thread/b458ad17/#8194):

I was doing some porting of components to SafeRTOS (the IEC 62304 certified version of FreeRTOS), and I noticed the pvPortMalloc and pvPortFree calls are no longer supported. SafeRTOS does not support (or need) any dynamic ram.

Given I want to use the FreeRTOS TCP stack on SafeRTOS, should I write a network allocator heap\_xxx.c for my networkInterface code to use that allocates a fixed number of buffers?

Anything else in the stack that will make this port difficult/impossible?

Thanks  
lc

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [August 24, 2015, 8:39pm UTC](https://forums.freertos.org/t/converting-freertos-labs-tcp-stack-to-freertos/4038/2 "2015-08-24T20:39:20Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Monday, August 24, 2015](https://sourceforge.net/p/freertos/discussion/382005/thread/b458ad17/#8e85):

SafeRTOS does not use dynamic memory allocation because, generally speaking, it is frowned upon in safety critical aps (non-deterministic and fragmentation being the main concerns).

There are not many places in the +TCP code that uses pvPortMalloc(). The main one is the allocation of network buffers, but [there is already an option to allocated them statically instead](http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/Embedded_Ethernet_Buffer_Management.html).

After that there are some small allocations being made in FreeRTOS\_socket() and vDNSSetCallBack(). It might be that you don’t use vDNSSetCallBack(), and as you suggest you could provide your own trivial implementation for FreeRTOS\_socket() as it will only ever allocated two different sizes - one size of UDP sockets and one size for TCP sockets.

Regards.
