- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Incidentally, I found everything more stable if I avoid use of malloc()/calloc().
-Marco G.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You cannot increase the heap size as it is automatically set to consume all the memory not allocated to static objects. We recommend avoiding malloc where possible and if required to malloc structures of variables rather than malloc individual variables.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for reminding me of how the heap is allocated and confirming that in fact there are issues with the use of malloc().
-Marco G.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I hate to bring this up but I have wiced_hostname_lookup() occasionally and inexplicably, failing. I checked the code and it uses malloc(). Any possible relationship?
Thanks,
-Marco G.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A failed call to malloc() may the cause of your problems. You should run your application while running the debugger and investigate the root cause when it fails. Using wiced_assert() liberally will have your program break when the error condition occurs minimizing the effort required.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I removed the only malloc and I don't really have problems. The only call that fails is the wiced_dns resolver that sometimes returns what it looks like a random IP address.
Sent from my iPad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Depending on the the IP stack you use the heap size can be changed. We use LWIP with an RTOS that is not packaged with WICED. To do this, we changed #define MEM_SIZE in opt.h and then changed the definition for mem_init, mem_free, and mem_malloc to call our OS supported memory functions which in turn use a memory pool set by the size of MEM_SIZE at compile time.
Also had to turn on MEM_LIBC_MALLOC, MEMP_MEM_MALLOC and force MEM_ALIGNMENT to 4.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If this is still an issue, maybe it is best to start a new discussion?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Definitely not an issue.
Thanks,
-Marco G.
ᐧ