Git Product home page Git Product logo

Comments (2)

0x00002a avatar 0x00002a commented on July 23, 2024

This part here:

conn->send(malloy::buffer(doc), [conn, handler = std::move(handler)]...

Is the issue. See this line:

* @warning The caller is responsible for keeping the memory of `payload`

doc is decontructed and the memory pointed to it (which malloy::buffer wraps but does not own see: asio docs) is deleted almost immediately.

You can wrap it in shared_ptr as a quick and dirty way to keep it around (which is what accept_and_send does iirc). The behaviour is a bit of a gotcha tbh, I'm open to ideas of how to make it less of a sharp corner :p.

from malloy.

Tectu avatar Tectu commented on July 23, 2024

Something about shooting yourself in the foot...? :p
The embarrassing thing is that I am/was aware of that and even read that notice when investigating.

This looks like a tricky case to take the edge off. I can currently not think of anything rather than a wrapper which creates the shared_ptr automatically. But then again, the details are so usage specific that it will most likely not be very beneficial of providing an out-of-the-box solution with malloy.
I think implementing application specific handlers similar to how the ws_handlers.cpp in /examples does it is the way to go - but that is application side, not malloy side.

from malloy.

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.