buglwIP - A Lightweight TCP/IP stack - Bugs: bug #48953, mdns has rather high stack usage...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #48953: mdns has rather high stack usage (sizeof(struct mdns_domain)*2)

Submitted by:  Simon Goldschmidt <goldsimon>
Submitted on:  Tue 30 Aug 2016 07:29:30 PM UTC  
 
Category: NoneSeverity: 2 - Minor
Item Group: Change RequestStatus: None
Privacy: PublicAssigned to: None
Open/Closed: OpenPlanned Release: None
lwIP version: git head

Fri 10 Mar 2017 10:13:17 PM UTC, comment #4:

mdns_readname_loop should be fixed (one copy avoided), but the bigger problem of allocating 2 mdns_domain structs on the stack remains. For some parts of the code, allocating those two opne after the other should work, but for some, it's not as easy...

-> changing the summary to reflect this

Simon Goldschmidt <goldsimon>
Project Administrator
Thu 15 Dec 2016 09:48:14 PM UTC, comment #3:

1k might be a little much, but struct mdns_domain (260 bytes) doesn't make it better. I mean if we really need this memory, so be it (rather allocate it on the stack where it's reusable for other code than allocating it seperately), but if we could avoid it it would be better :-)

If we can't avoid it, I'll just close this item, but in that case we should point out the stack requirements (and give a calculation hint) when using the mDNS resolver.

Simon Goldschmidt <goldsimon>
Project Administrator
Mon 19 Sep 2016 05:28:48 AM UTC, comment #2:

On my project, in order to get mDNS to work I had to add about 1k extra stack space to both the TCP/IP thread and my Ethernet input thread (the latter probably due to LWIP_TCPIP_CORE_LOCKING_INPUT).

Daniel Elstner <danielk>
Wed 31 Aug 2016 08:44:30 AM UTC, comment #1:

This is mentioned in the documentation that it uses some stack.

Many of the answer writing functions (mdns_add_XXXXX_answer) have two mdns_domain structs on the stack (259 or so bytes each)

Erik Ekman <yarrick>
Project Member
Tue 30 Aug 2016 07:29:30 PM UTC, original submission:

mdns_readname_loop() decodes a DNS name (this is kind of duplicate to what dns.c does, already, so might be merged?).
However, when doing so, it allocates a 63 byte array on the stack. This is rather not the coding style lwIP has had so far: the stack has so far tried to keep stack usage minimal...

Simon Goldschmidt <goldsimon>
Project Administrator

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by danielk (Posted a comment)
  • -unavailable- added by yarrick (Posted a comment)
  • -unavailable- added by goldsimon (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 10 Mar 2017 10:13:17 PM UTCgoldsimonSeverity3 - Normal=>2 - Minor
      Summarymdns_readname_loop() allocates rather big array on the stack=>mdns has rather high stack usage (sizeof(struct mdns_domain)*2)

    Back to the top


    Powered by Savane 3.1-cleanup1