GithubHelp home page GithubHelp logo

Comments (9)

proddy avatar proddy commented on July 21, 2024

these days std::string is easier. See this example.

from esp8266-react.

uncodead avatar uncodead commented on July 21, 2024

from esp8266-react.

proddy avatar proddy commented on July 21, 2024

all stl/std libraries take some space, but its not too much and a lot simpler than writing your own string functions. If you use String correctly you won't get into problems with stability and I think rjwats knows what he's doing. However if memory is a problem then you shouldn't really use react and look at preact which has a much smaller footprint. I'm seeing if I can port some of this to preact as an experiment.

from esp8266-react.

uncodead avatar uncodead commented on July 21, 2024

from esp8266-react.

rjwats avatar rjwats commented on July 21, 2024

If you are having memory leak issues I'd be interested in seeing the code and conditions under which you are experiencing the issues.

I have a SoapUI project which I use locally to load-test the projects endpoints (1000s of requests to each endpoint) before I merge changes - memory leaks would be fairly awful.

I haven't experienced any memory leaks to date, though it is of course possible a change in the esp core or libraries used could have introduced a problem. Do you have any more details of why you think you have a memory issue? I could send you my SoapUI project (or check it in) so you can run the tests yourself.

Let me know!

from esp8266-react.

proddy avatar proddy commented on July 21, 2024

Are we talking about same memory? Im talking about heap memory.

std::string supports “Small String Optimization” (SSO) meaning it stores short strings locally and only uses the heap for long strings. By reducing the number of small objects in the heap, the SSO reduces the fragmentation which can lead to memory problems you see with the Arduino String class.

If you want to monitor memory, put something like

in setup()

static uint32_t _heap = ESP.getFreeHeap();

in loop()

    uint32_t total_memory = _heap;
    uint32_t free_memory  = ESP.getFreeHeap();

    Serial.printf("Free Heap: %d bytes initially | %d bytes used (%2u%%) | %d bytes free (%2u%%)",
            total_memory,
            total_memory - free_memory,
            100 * (total_memory - free_memory) / total_memory,
            free_memory,
            100 * free_memory / total_memory);

from esp8266-react.

proddy avatar proddy commented on July 21, 2024

@rjwats I'm progressing on implementing some of those changes I talked about before (centralizing settings, mqtt, syslog, telnet console etc) and will upload soon to my GitHub fork. I was wondering if you would mind sharing the SoapUI project so I can also bash the end-points to make sure its stable?

from esp8266-react.

rjwats avatar rjwats commented on July 21, 2024

Looking forward to seeing what you've done and to see what can be brought over to the core. Did you find a clean approach for managing settings in the end? Doing that in a modular way looked like it would be the most difficult bit.

Hoping to find some time over the xmas break to work on some of this myself - making the build modular for a start.

I'll try and remember to share the file when I get the chance, though might not be till tomorrow as I'm busy this evening.

from esp8266-react.

proddy avatar proddy commented on July 21, 2024

Think you can close this.

from esp8266-react.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.