Modify

Opened 4 years ago

Closed 4 years ago

#8624 closed Bugs (fixed)

Large objects passed by value

Reported by: Richard <legalize@…> Owned by: chris_kohlhoff
Milestone: To Be Determined Component: asio
Version: Boost 1.52.0 Severity: Optimization
Keywords: Cc:

Description

In asio/detail/reactive_socket_service_base.hpp:

198  template <typename ConstBufferSequence, typename Handler>
199  void async_send(base_implementation_type& impl,
200      const ConstBufferSequence& buffers,

CID 10918 (#1-5 of 5): Big parameter passed by value (PASS_BY_VALUE)
pass_by_value: Passing parameter handler of type
    boost::asio::detail::write_op<
        boost::asio::basic_stream_socket<
            boost::asio::ip::tcp,
            boost::asio::stream_socket_service<boost::asio::ip::tcp>
        >,
        boost::asio::mutable_buffers_1,
        boost::asio::detail::transfer_all_t,
        boost::asio::ssl::detail::io_op<
            boost::asio::basic_stream_socket<
                boost::asio::ip::tcp,
                boost::asio::stream_socket_service<boost::asio::ip::tcp>
            >,
            boost::asio::ssl::detail::write_op<
                boost::asio::detail::consuming_buffers<
                    boost::asio::const_buffer,
                    std::vector<boost::asio::const_buffer>
                >
            >,
        boost::asio::detail::write_op<
            boost::asio::ssl::stream<
                boost::asio::basic_stream_socket<
                    boost::asio::ip::tcp,
                    boost::asio::stream_socket_service<boost::asio::ip::tcp>
                >
            >,
            std::vector<boost::asio::const_buffer>,
            boost::asio::detail::transfer_all_t,
            boost::function2<void, boost::system::error_code const &, unsigned long>
            >
        >
    > (size 256 bytes) by value. 
201      socket_base::message_flags flags, Handler handler)
202  {

Same for async_receive.

In asio/handler_invoke_hook.hpp:

61 template <typename Function>

CID 10407 (#1-12 of 12): Big parameter passed by value (PASS_BY_VALUE)
pass_by_value: Passing parameter function of type
    boost::asio::detail::binder2<
        boost::asio::detail::write_op<
            boost::asio::basic_stream_socket<
                boost::asio::ip::tcp,
                boost::asio::stream_socket_service<boost::asio::ip::tcp>
            >,
            std::vector<boost::asio::const_buffer>,
            boost::asio::detail::transfer_all_t,
            boost::function2<void, boost::system::error_code const &, unsigned long>
        >,
        boost::system::error_code, unsigned long
    > (size 136 bytes) by value. 

62 inline void asio_handler_invoke(Function function, ...)

In asio/impl/write.hpp:

548  template <typename AsyncWriteStream, typename ConstBufferSequence,
549      typename CompletionCondition, typename WriteHandler>
550  inline write_op<AsyncWriteStream, ConstBufferSequence,
551      CompletionCondition, WriteHandler>
552  make_write_op(AsyncWriteStream& s, const ConstBufferSequence& buffers,

CID 10920 (#1-3 of 3): Big parameter passed by value (PASS_BY_VALUE)
pass_by_value: Passing parameter handler of type
    boost::asio::ssl::detail::io_op<
        boost::asio::basic_stream_socket<
            boost::asio::ip::tcp,
            boost::asio::stream_socket_service<boost::asio::ip::tcp>
        >,
        boost::asio::ssl::detail::write_op<
            boost::asio::detail::consuming_buffers<
                boost::asio::const_buffer,
                std::vector<boost::asio::const_buffer>
            >
        >,
        boost::asio::detail::write_op<
            boost::asio::ssl::stream<
                boost::asio::basic_stream_socket<
                    boost::asio::ip::tcp,
                    boost::asio::stream_socket_service<boost::asio::ip::tcp>
                >
            >,
            std::vector<boost::asio::const_buffer>,
            boost::asio::detail::transfer_all_t,
            boost::function2<void, boost::system::error_code const &, unsigned long>
        >
    > (size 224 bytes) by value. 

553      CompletionCondition completion_condition, WriteHandler handler)
554  {
555    return write_op<AsyncWriteStream, ConstBufferSequence, CompletionCondition,
556      WriteHandler>(s, buffers, completion_condition, handler);
557  }

Attachments (0)

Change History (1)

comment:1 Changed 4 years ago by chris_kohlhoff

  • Resolution set to fixed
  • Status changed from new to closed

Fixes on trunk in [85749] and [85763]. Merged to release in [85838].

N.B. some copies are unavoidable in C++03 due to the need to obtain a non-const handler object. In C++11 most of these instances can use move construction rather than copy construction.

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain chris_kohlhoff.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.