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

Multiple instances of INADDR_NONE [imported] #1007

Closed
cmaglie opened this issue Nov 15, 2012 · 2 comments
Closed

Multiple instances of INADDR_NONE [imported] #1007

cmaglie opened this issue Nov 15, 2012 · 2 comments
Assignees
Labels
Component: Core Related to the code for the standard Arduino API

Comments

@cmaglie
Copy link
Member

cmaglie commented Nov 15, 2012

This is Issue 1007 moved from a Google Code project.
Added by 2012-08-16T18:20:18.000Z by [email protected].
Please review that bug for more context and additional comments, but update this bug.

Original labels: Type-Defect, Priority-Medium

Original description

What steps will reproduce the problem?

  1. Sketch with two files, each importing (directly or indirectly) IPAddress.h
  2. avr-nm -n on the resulting elf (on Windows)

What is the expected output? What do you see instead?
Expect only a single instance of INADDR_NONE in .bss section, but multiple are allocated, consuming precious SRAM space (in my case of a bigger piece of software, seven instances).

Note also that IPAddress consumes six bytes, not four, due to the class pointer required for the virtual function.

This is on arduino-1.0.1 under Windows 7.

Please provide any additional information below.
Suggest to declare INADDR_NONE extern in IPAddress.h, and to define it in IPAddress.cpp.

@jindrabasek
Copy link

I can see this bug is still happening even in the latest IPAddress.h version.

const IPAddress INADDR_NONE(0,0,0,0);

If IPAddress.h is imported/used in multiple files it causes big SRAM space loss.

const IPAddress INADDR_NONE(0,0,0,0); should me marked extern and defined in IPAddress.cpp

@per1234 per1234 added the Component: Core Related to the code for the standard Arduino API label Jul 2, 2017
@hachi
Copy link

hachi commented Jan 25, 2018

I just ran across this bug while trying to figure out what was eating all my sram in .data and .bss. Turns out I had about 15 copies of this and at 6 bytes each that's a big chunk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Core Related to the code for the standard Arduino API
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants