mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 00:55:52 +03:00
[GH-ISSUE #518] Memory optimization #433
Labels
No labels
📶 WiFi
🕸️ HTTP
Branch
DEV Help Wanted
Discussion
Documentation
ESP32
Example
Good First Issue
Hotfix
In Progress
Incomplete
Needs Feeback
Priority
QA
Question
Task
Upstream/Dependancy
bug
duplicate
enhancement
invalid
pull-request
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/WiFiManager#433
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @tablatronix on GitHub (Feb 14, 2018).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/518
optimize memory usage, namely RAM
Stringspagestrings size, does it matter ?@tablatronix commented on GitHub (Feb 14, 2018):
Made sure all debug and strings were wrapped in F(), eventually all debug strings will be moved to strings.h with precompiler flags to remove them entirely.
ESP DEBUGGING IS ON
@tablatronix commented on GitHub (Feb 14, 2018):
data : 0x3ffe8000 ~ 0x3ffe852c, len: 1324
rodata: 0x3ffe8530 ~ 0x3ffea23c, len: 7436
bss : 0x3ffea240 ~ 0x3fff1838, len: 30200
heap : 0x3fff1838 ~ 0x3fffc000, len: 42952
*WM: getCoreVersion(): 00000000
*WM: system_get_sdk_version(): 2.1.0(deb1901)
*WM: system_get_boot_version(): 31
*WM: getFreeHeap(): 38640
@horendus commented on GitHub (Feb 15, 2018):
Fantastic :)
@tablatronix commented on GitHub (Nov 12, 2019):
Investigate fragmentation, suspect is page html and params replace strings, user params
@nikeee commented on GitHub (Aug 24, 2020):
Using the development branch on my ESP32 on Platformio:
With WiFiManager:
And without WiFiManager:
(compiled in release mode with optimizations)
Which is 385386 (~385kB) difference in flash.
I remember that the master branch was more lightweight when I used it for an ESP8266.
Is there anything I can do on my side to reduce memory usage?
@tablatronix commented on GitHub (Aug 25, 2020):
hmm, well all debugging is left in, they are not conditional, so removing all debug statements might help. There might be some cruft in dev since its still alpha that can be removed.. also there is a lot of info page stuff that I intend to make optional somehow, compiler directives for now probably.
I would suspect the css additions.
Remove the images, and go back to percentage tokens, no graph
I can play with it, but it might be a while before I have time atm.
Might want to create an issue just for this optimizations so we can select them out easily.
for now defines work fine and we can branch or pio config low mem options.
There are also some very useful wifi helpers, that could be removed, like textual status() strings etc
all the help page docs..
@nikeee commented on GitHub (Aug 26, 2020):
That seems like a good idea.
What I was also thinking of is offering the user the option to supply his own HTML and CSS (not just the ability to append CSS, but all if the HTML/CSS). For my current use-case that would be easier than overwriting the existing CSS while being more compact.
@tablatronix commented on GitHub (Aug 26, 2020):
There IS a define check for the strings, so you can do that at compiler level if you wanted to and replace them elsewhere, problem is its still flash, in order to switch to littlefs/spiffs strings it would require code changes.
@nikeee commented on GitHub (Aug 26, 2020):
Do you mean this define: https://github.com/tzapu/WiFiManager/blob/development/strings_en.h#L16?
Despite the comment, does defining an own set of strings work by something like this?
I feel like I'd have more customization options if this function would be
virtual, so the WiFiManager could be inherited and this function could be implemented by the library user:github.com/tzapu/WiFiManager@31be25d54b/WiFiManager.cpp (L945-L963)This might not solve the RAM/Flash issue, though.
@tablatronix commented on GitHub (Aug 27, 2020):
Yeah, this was the first step to abstract and organize the code so it can be refactored better. That func was one of the latest additions with that in mind.
@dalbert2 commented on GitHub (Apr 4, 2023):
For ESP8266 users, IRAM is a critical resource; the SSL library requires a lot of free heap and anything that reduces it is a problem. The WiFiManager is amazing, but it consumes roughly 2.3K of IRAM even when not instantiated.
Are there ways to reduce WiFiManager IRAM usage when not using (or even instantiating) the WiFiManager?
@tablatronix commented on GitHub (Apr 5, 2023):
I am assuming this is all the strings, specifically the html, try removing the HTTP_STYLE css like icons and stuff and see what you find, i made a minimal version to test but it was a long time ago
https://github.com/tzapu/WiFiManager/blob/master/wm_strings_en.h#L90
@dalbert2 commented on GitHub (Apr 14, 2023):
I submitted a separate issue #1587 addressing at least two problems:
I provided examples of how to do it properly and can submit a fix if desired, but the more serious issue is:
so any code that includes WiFiManager.h also creates instances of those strings.
Why aren't those strings declared in a compilation unit and declared extern in header files (if needed)?
@tablatronix commented on GitHub (Apr 15, 2023):
.2 but there are include guards..?