Open hossainimtiaz opened 5 years ago
I also have the problem
Have same problem in Windows
Has this ever been resolved? I am using version 0.81 and I still see the problem
I am using version 0.82 and I still see the problem, os is centos 7
server on arm device leak memory too
Hi,
I am trying to develop a Stomp-Ws client using WebsocketPP. The client is working fine in Ubuntu but leaking memory in Tizen.
Unfortunately, Tizen 3.0 doesn't support valgrind so I am unable to pinpoint the leak in Tizen. While trying to check step-by step I have found that "WebsocketEndpoint::send(std::string message)" is leaking memory over time.
Interestingly a non-secured endpoint doesn't leak memory.
I am now confused if it is a OpenSSL related bug (if so, what is the work around) or it is my implementation mistake.
`#include
include
include
include
include
include
include
include <openssl/ssl.h>
include <curl/curl.h>
//Tizen
include "Utility.h"
include "StompClient.h"
include "StompFrame.h"
include "StompFrameHandler.h"
include "ResponseCode.h"
using websocketpp::lib::placeholders::_1; using websocketpp::lib::placeholders::_2; using websocketpp::lib::bind;
// pull out the type of messages sent by our config
void ConnectionMetadata::on_open_listener(client *c, websocketpp::connection_hdl hdl) { m_status = "Open"; DLOG("on_open called"); client::connection_ptr con = c->get_con_from_hdl(hdl); m_server = con->get_response_header("Server"); m_worker_is_done = true; m_condition_variable.notify_one(); }
void ConnectionMetadata::on_fail_listener(client *c, websocketpp::connection_hdl hdl) { m_status = "Failed"; DLOG("on_fail called"); client::connection_ptr con = c->get_con_from_hdl(hdl); m_server = con->get_response_header("Server"); m_error_reason = con->get_ec().message(); m_worker_is_done = true; m_condition_variable.notify_one();
}
void ConnectionMetadata::on_close_listener(client *c, websocketpp::connection_hdl hdl) { DLOG("on_close called"); m_status = "Closed"; client::connection_ptr con = c->get_con_from_hdl(hdl); std::stringstream s; s << "close code: " << con->get_remote_close_code() << " (" << websocketpp::close::status::get_string(con->get_remote_close_code()) << "), close reason: " << con->get_remote_close_reason(); m_error_reason = s.str();
}
void ConnectionMetadata::on_message_listener(websocketpp::connection_hdl, client::message_ptr msg) { DLOG("on_message called"); std::string payload = msg->get_payload(); std::stringstream ss(payload); std::string response; std::getline(ss, response, '\n'); std::string connected = "Connected"; StompFrame stompFrame;
}
websocketpp::connection_hdl ConnectionMetadata::get_hdl() const { return m_hdl; }
std::string ConnectionMetadata::get_status() const { return m_status; }
void ConnectionMetadata::record_sent_message(std::string message) { m_messages.push_back(">> " + message); }
std::ostream &operator<< (std::ostream &out, ConnectionMetadata const &data) { out << "> URI: " << data.m_uri << "\n" << "> Status: " << data.m_status << "\n" << "> Remote Server: " << (data.m_server.empty() ? "None Specified" : data.m_server) << "\n" << "> Error/close reason: " << (data.m_error_reason.empty() ? "N/A" : data.m_error_reason) << "\n"; out << "> Messages Processed: (" << data.m_messages.size() << ") \n";
}
WebsocketEndpoint::WebsocketEndpoint (std::string id) : m_id (id) { DLOG("WebsocketEndpoint IN"); m_client_endpoint.clear_access_channels(websocketpp::log::alevel::all); m_client_endpoint.clear_error_channels(websocketpp::log::elevel::all);
}
WebsocketEndpoint::~WebsocketEndpoint() {
}
bool WebsocketEndpoint::connect(std::string const &uri, int connection_waiting_timeout, std::function<void(ResponseCode, std::string)> server_reponse_listener) {
}
void WebsocketEndpoint::close(websocketpp::close::status::value code, std::string reason) { DLOG("WebsocketEndpoint::close IN");
websocketpp::lib::error_code ec;
}
void WebsocketEndpoint::send(std::string message) { //DLOG("WebsocketEndpoint::send IN");
}
void WebsocketEndpoint::on_socket_init(websocketpp::connection_hdl hdl) { (void) hdl; std::cout << "on_socket_init called" << std::endl; m_socket_init = std::chrono::high_resolution_clock::now(); }
context_ptr WebsocketEndpoint::on_tls_init(websocketpp::connection_hdl hdl) { std::cout << "on_tls_init called" << std::endl; (void) hdl; m_tls_init = std::chrono::high_resolution_clock::now(); context_ptr ctx(new boost::asio::ssl::context(boost::asio::ssl::context::tlsv1));
}
ConnectionMetadata::ptr WebsocketEndpoint::getMetadata() const { return m_connection; }`