GithubHelp home page GithubHelp logo

Comments (4)

scaprile avatar scaprile commented on June 1, 2024

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.

jvo203 avatar jvo203 commented on June 1, 2024

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.

scaprile avatar scaprile commented on June 1, 2024

@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.

cpq avatar cpq commented on June 1, 2024

@jvo203 @scaprile

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)

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.