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

Low heap. #337

Closed
chadouming opened this issue Apr 6, 2015 · 16 comments
Closed

Low heap. #337

chadouming opened this issue Apr 6, 2015 · 16 comments

Comments

@chadouming
Copy link

With the recent addition of a lot of features, the available heap is now very low. With MQTT and COAP module disabled, I can get an available heap of 18kB, which is not enough to run most of my programs. Just to get my esp to publish a temperature taken from a dht22 every 5 minutes, I have to disable many modules. I don't use much of the user data available (maybe 8kB of the 80kB available) Is there any way to make a swap file? This would not be as fast as using the ram of course, however, it would allow people to run program even if the heap goes down. It could also prevent a lot of panic.

@zenmanenergy
Copy link

I am feeling the same pain with the heap.

I did find that using node.compile() helps considerably. Not that this answers your question, but it's a bandaid fix.

@marcoskirsch
Copy link

I'm of the opinion that the default builds should have all non essential features disabled, so that people can opt-in and add what they need. Better than having everything enabled by default even though most of it is not needed by most applications, yet people don't even know it's there using up memory.

The first one is a little more painful but less prone to error.

@TerryE
Copy link
Collaborator

TerryE commented Apr 27, 2015

Most Open-source projects use Autoconf and come with a ./configure command to tailor the make and handle all of the dependencies, so ideally building the firmware would just be a matter of

git clone https://github.com/nodemcu/nodemcu-firmware.git 
sudo apt-get install $SOME_DEPENDENCY_LIST
./configure --enable-ow --disable-mqtt --enable-cjson ...
make
# and now the firmware is complete

Shouldn't this be the way to go? OK we might need a Windows MinGW or Cygwin version for the poor sods still running Win$$, but this would be a fairly easy delta, surely?

@chadouming, keep a watch on the ESP8266 forum where I will be developing a nodeMCU unofficial FAQ to help address your constraints. It's mainly a question of programming techniques.

@ramgarden
Copy link

My only linux box are my raspberry pi's. Would I be able to compile on that or would I need to actually borrow a linux machine or just dual boot like a normal person? I'm thinking the ARM architecture would be a problem there? Or is it just a matter of GCC version?

@TerryE
Copy link
Collaborator

TerryE commented Apr 27, 2015

@ramgarden, In the days when my company provided my laptops and mandated a standard Windows build, I used to run either Cygwin or an Ubuntu VM under virtualbox for all of my Open-source development work, so having a *nix envirnment under Win$$ is pretty straight forward. But for the last 10 years or so, I've only used Linux.

As to ARM, I think that the Xtensia toolchain is fully open-source and not x86-specific so in principle it should be buildable on ARM, but you'll need to scan the forums on this one and I would also suggest that you use an RPi2 as a quad-core ARM7 chip with 2Gb RAM is a far better dev engine.

@cal101
Copy link
Contributor

cal101 commented Apr 27, 2015

Moin,

autoconf is far too big for those simple needs IMHO.
It's just editing one file not about building the GCC suite.
I wonder if some kind of "poor mans plugins" what ever that may mean can be a solution.

Carsten

@TerryE
Copy link
Collaborator

TerryE commented Apr 27, 2015

Carsten, in the case of simple needs, then the autoconf is also simple. The great advantage of this approach is the a typical developer can tailor the package with a single command and he or she doesn't have to start taking apart the makefile hierarchy

@csirk51
Copy link

csirk51 commented May 6, 2015

Hi,
Could anyone post the proper way of disabling unneccessary modules to free up some memory? Which files shoud be changed before building?

@vudangngoc
Copy link

You can exclude some module depend on your solution at link bellow. Please googling and understand a module before disable it.
https://github.com/nodemcu/nodemcu-firmware#build-option

@marcoskirsch
Copy link

That's ridiculous. The code should be documented clearly in the header file itself.

@TerryE
Copy link
Collaborator

TerryE commented May 7, 2015

@marcoskirsch, Marcos, what is rediculous? @vudangngoc gave a direct answer to csirk51's Q. The caveat that you should check dependencies and understand the implications before disabling a module is sensible. Many of us would prefer better inline documentation, but that is an issue for the original authors and others to contribute to, surely?

@csirk51
Copy link

csirk51 commented May 7, 2015

@vudangngoc, Thanks for the answer, I could finally free up some memory to run my script.

@TerryE
Copy link
Collaborator

TerryE commented May 7, 2015

@csirk51, there are plenty of application techniques that you can use and which will materially drop the RAM demands of your scripts, but this is a "How To" topic better suited to a developer forum such as esp8266.com or StackOverflow.

@marcelstoer
Copy link
Member

@TerryE

The caveat that you should check dependencies and understand the implications before disabling a module is sensible.

Indeed, that's the reason I created #386 so time ago.

"How To" topic better suited to ... StackOverflow

OT for this issue but I noticed you keep referring to StackOverflow but there's neither an esp8266 nor a nodemcu tag. Around which tag does this small community gather on StackOverflow?

@TerryE
Copy link
Collaborator

TerryE commented May 7, 2015

@marcelstoer I found esp8266.com so I post there. But I don't want to preclude other options and StackOverflow is such a one. As it happens I post to StackOverflow to answer apache, htaccess, php and opcache Qs amongst others. I agree that there's no elua or nodemcu tags yet, but that's only because people aren't asking the Qs there. It would be a good forum to use and I do track the lua tag but the volume of posts here are posters asking about using lua as an embedded scripting language inside some game or other 😒

@TerryE
Copy link
Collaborator

TerryE commented Nov 2, 2015

The current dev changes address this within the constraints of the h/w.

@TerryE TerryE closed this as completed Nov 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants