Comments (4)
Mongoose needs to get that amount of memory from somewhere. If you expect to pass 1MB chunks, then you need at least a 1MB task stack. That function wasn't meant to be used with huge chunks of memory, you can change alloca for alloc and that memory will come out of your heap instead of your task stack. That may be great for your case but a penalty for typical applications passing a simple response.
from mongoose.
Yes I agree the memory has to come out of somewhere. As you say, either the stack needs to be made sufficiently large or that memory has to come from the heap.
Personally I don't send 1MB payloads 'as is'. As you are aware I send pointers to large payloads, pointers do not take up much memory so using alloca()
is not a pressing problem.
If you think it's OK to close this issue without changing mongoose then it's absolutely OK with me too. It's just one thing to keep in mind when using mongoose, one needs to be aware of the stack size etc.
from mongoose.
@cpq I think we should keep things as they are. I can add a note on stack usage at the function entry in the API docs. IMO, having several allocs for small messages would be detrimental. We already have a note telling users to dimension their stack, they are just missing this new piece of information. WDYT ?
from mongoose.
We should not send messages so big.
They are sent over UDP socketpair, which has its internal limit.
I am not sure that we should impose the limit in the code, let's change the documentation.
I've updated the docs, https://mongoose.ws/documentation/#mg_wakeup
from mongoose.
Related Issues (20)
- MacOS unit tests fail with MbedTLS HOT 9
- Is it possible to add the mg_mqtt_unsub function? HOT 3
- mqtt: Unable to set zero-length Will message
- how can we access fn_data from mg_http_listen's callback funtion (mg_event_handler_t) ? HOT 3
- [Request feature] can you support wolfssl library HOT 3
- upload in https using examplefile-upload-html-form is always pending in chrome but is ok in firefox. HOT 1
- Socket error after ota-updating the filesystem image HOT 1
- Fix for #2619 breaks fix for #2603 HOT 3
- Cleanup string API HOT 5
- mongoose.c:7543:accept_conn 1 accept failed, errno 24 HOT 1
- mg_http_next_multipart bug HOT 3
- cannot connect MQTT to STM32F407 HOT 1
- When I used the TLS scanning tool (https://github.com/rbsec/sslscan, scanning command: sslscan --tlsall 127.0.0.1:8443) to scan the 8443 port of the mongoose examples http-restful-server, the program appeared Infinite loop, continuous log printing, even if I have ended the TLS scan command. HOT 2
- The "mg_url_host" function is not work? HOT 1
- Can FreeRTOS_IPInit_Multi function be used properly? HOT 3
- Wrong assets in 7.14 HOT 1
- Mongoose accepts HTTP requests with invalid versions
- Mongoose accepts requests containing multiple differing Content-Length headers.
- Mongoose ignores `Connection: close` headers
- Potential Memory Leak in `mg_timer_free` Function HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mongoose.