Optimize memory allocation for client buffer; add VLD to detect memory on Windows.

This commit is contained in:
Adam Gu
2018-07-05 16:07:26 +08:00
parent 7280b09f10
commit b85377c3a3
72 changed files with 549 additions and 62 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ void Test(boost::asio::io_context& ioc) {
}
int main() {
LOG_INIT("", webcc::LOG_CONSOLE);
WEBCC_LOG_INIT("", webcc::LOG_CONSOLE);
boost::asio::io_context ioc;
+1 -1
View File
@@ -28,7 +28,7 @@ void Test() {
}
int main() {
LOG_INIT("", webcc::LOG_CONSOLE);
WEBCC_LOG_INIT("", webcc::LOG_CONSOLE);
Test();
Test();
+1 -1
View File
@@ -101,7 +101,7 @@ int main(int argc, char* argv[]) {
return 1;
}
LOG_INIT("", webcc::LOG_CONSOLE);
WEBCC_LOG_INIT("", webcc::LOG_CONSOLE);
std::string host = argv[1];
std::string port = argv[2];
+14 -1
View File
@@ -5,6 +5,19 @@
#include "webcc/logger.h"
#include "webcc/rest_client.h"
// In order to run with VLD, please copy the following files to the example
// output folder from "third_party\win32\bin":
// - dbghelp.dll
// - Microsoft.DTfW.DHL.manifest
// - vld_x86.dll
#if (defined(WIN32) || defined(_WIN64))
#if defined(_DEBUG) && defined(WEBCC_ENABLE_VLD)
#pragma message ("< include vld.h >")
#include "vld/vld.h"
#pragma comment(lib, "vld")
#endif
#endif
// -----------------------------------------------------------------------------
// Write a JSON object to string.
@@ -160,7 +173,7 @@ int main(int argc, char* argv[]) {
return 1;
}
LOG_INIT("", webcc::LOG_CONSOLE);
WEBCC_LOG_INIT("", webcc::LOG_CONSOLE);
std::string host = argv[1];
std::string port = argv[2];
+14 -1
View File
@@ -5,6 +5,19 @@
#include "book_services.h"
// In order to run with VLD, please copy the following files to the example
// output folder from "third_party\win32\bin":
// - dbghelp.dll
// - Microsoft.DTfW.DHL.manifest
// - vld_x86.dll
#if (defined(WIN32) || defined(_WIN64))
#if defined(_DEBUG) && defined(WEBCC_ENABLE_VLD)
#pragma message ("< include vld.h >")
#include "vld/vld.h"
#pragma comment(lib, "vld")
#endif
#endif
void Help(const char* argv0) {
std::cout << "Usage: " << argv0 << " <port> [seconds]" << std::endl;
std::cout << "If |seconds| is provided, the server will sleep these seconds "
@@ -21,7 +34,7 @@ int main(int argc, char* argv[]) {
return 1;
}
LOG_INIT("", webcc::LOG_FILE | webcc::LOG_CONSOLE | webcc::LOG_OVERWRITE);
WEBCC_LOG_INIT("", webcc::LOG_CONSOLE);
unsigned short port = std::atoi(argv[1]);
+1 -1
View File
@@ -5,7 +5,7 @@
#include "calc_client.h"
int main() {
LOG_INIT("", webcc::LOG_CONSOLE);
WEBCC_LOG_INIT("", webcc::LOG_CONSOLE);
CalcClient calc;
+1 -1
View File
@@ -17,7 +17,7 @@ int main(int argc, char* argv[]) {
return 1;
}
LOG_INIT("", webcc::LOG_CONSOLE);
WEBCC_LOG_INIT("", webcc::LOG_CONSOLE);
unsigned short port = std::atoi(argv[1]);