diff --git a/include/dsn/tool-api/global_config.h b/include/dsn/tool-api/global_config.h index fb6b8920e4..dfd916976c 100644 --- a/include/dsn/tool-api/global_config.h +++ b/include/dsn/tool-api/global_config.h @@ -162,8 +162,6 @@ struct service_spec std::string nfs_factory_name; std::string perf_counter_factory_name; std::string logging_factory_name; - std::string memory_factory_name; // for upper applications - std::string tools_memory_factory_name; // for rDSN itself and lower tools std::list network_aspects; // toollets compatible to the above network main // providers in network configs @@ -220,8 +218,6 @@ CONFIG_FLD_STRING(semaphore_factory_name, "", "semaphore provider") CONFIG_FLD_STRING(nfs_factory_name, "", "nfs provider") CONFIG_FLD_STRING(perf_counter_factory_name, "", "peformance counter provider") CONFIG_FLD_STRING(logging_factory_name, "", "logging provider") -CONFIG_FLD_STRING(memory_factory_name, "", "memory management provider") -CONFIG_FLD_STRING(tools_memory_factory_name, "", "memory management provider for tools") CONFIG_FLD_STRING_LIST(network_aspects, "network aspect providers, usually for tooling purpose") CONFIG_FLD_STRING_LIST(aio_aspects, "aio aspect providers, usually for tooling purpose") diff --git a/include/dsn/tool-api/memory_provider.h b/include/dsn/tool-api/memory_provider.h deleted file mode 100644 index 7e44b89ffc..0000000000 --- a/include/dsn/tool-api/memory_provider.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 Microsoft Corporation - * - * -=- Robust Distributed System Nucleus (rDSN) -=- - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -/* - * Description: - * What is this file about? - * - * Revision history: - * xxxx-xx-xx, author, first version - * xxxx-xx-xx, author, fix bug about xxx - */ - -#pragma once -#include - -namespace dsn { - -class memory_provider -{ -public: - template - static memory_provider *create() - { - return new T(); - } - - typedef memory_provider *(*factory)(); - -public: - memory_provider() {} - - virtual ~memory_provider(void) {} - - virtual void *allocate(size_t sz) { return ::malloc(sz); } - - virtual void *reallocate(void *ptr, size_t sz) { return ::realloc(ptr, sz); } - - virtual void deallocate(void *ptr) { ::free(ptr); } -}; -} diff --git a/include/dsn/tool_api.h b/include/dsn/tool_api.h index 334d0845ed..06f5db495a 100644 --- a/include/dsn/tool_api.h +++ b/include/dsn/tool_api.h @@ -63,7 +63,6 @@ Component providers define the interface for the local components (e.g., network #include #include #include -#include #include namespace dsn { @@ -162,9 +161,6 @@ register_component_provider(const char *name, perf_counter::factory f, ::dsn::pr DSN_API bool register_component_provider(const char *name, logging_provider::factory f, ::dsn::provider_type type); -DSN_API bool register_component_provider(const char *name, - memory_provider::factory f, - ::dsn::provider_type type); DSN_API bool register_component_provider(const char *name, nfs_node::factory f, ::dsn::provider_type type); DSN_API bool register_component_provider(network_header_format fmt, diff --git a/src/core/core/memory_provider.cpp b/src/core/core/memory_provider.cpp deleted file mode 100644 index 05b3b37ef4..0000000000 --- a/src/core/core/memory_provider.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015 Microsoft Corporation - * - * -=- Robust Distributed System Nucleus (rDSN) -=- - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -/* - * Description: - * What is this file about? - * - * Revision history: - * xxxx-xx-xx, author, first version - * xxxx-xx-xx, author, fix bug about xxx - */ - -#include - -namespace dsn { -} \ No newline at end of file diff --git a/src/core/core/service_api_c.cpp b/src/core/core/service_api_c.cpp index 9a67a99419..8de57937cb 100644 --- a/src/core/core/service_api_c.cpp +++ b/src/core/core/service_api_c.cpp @@ -76,7 +76,6 @@ static struct _all_info_ ::dsn::tools::tool_app *tool; ::dsn::service_engine *engine; std::vector<::dsn::task_spec *> task_specs; - ::dsn::memory_provider *memory; bool is_config_completed() const { return magic == 0xdeadbeef && config_completed; } @@ -689,7 +688,6 @@ bool run(const char *config_file, dsn_all.config_completed = false; dsn_all.tool = nullptr; dsn_all.engine = &::dsn::service_engine::instance(); - dsn_all.memory = nullptr; dsn_all.magic = 0xdeadbeef; if (!dsn_config_load(config_file, config_arguments)) { @@ -766,8 +764,6 @@ bool run(const char *config_file, 1024, // 1 MB "thread local transient memory buffer size (KB), default is 1024"); ::dsn::tls_trans_mem_init(tls_trans_memory_KB * 1024); - dsn_all.memory = ::dsn::utils::factory_store<::dsn::memory_provider>::create( - spec.tools_memory_factory_name.c_str(), ::dsn::PROVIDER_TYPE_MAIN); // prepare minimum necessary ::dsn::service_engine::fast_instance().init_before_toollets(spec); diff --git a/src/core/core/service_engine.cpp b/src/core/core/service_engine.cpp index 82efb6783a..345d18cee6 100644 --- a/src/core/core/service_engine.cpp +++ b/src/core/core/service_engine.cpp @@ -39,7 +39,6 @@ #include "rpc_engine.h" #include #include -#include #include #include #include @@ -399,7 +398,6 @@ service_engine::service_engine(void) { _env = nullptr; _logging = nullptr; - _memory = nullptr; ::dsn::command_manager::instance().register_command({"engine"}, "engine - get engine internal information", @@ -419,8 +417,6 @@ void service_engine::init_before_toollets(const service_spec &spec) // init common providers (first half) _logging = factory_store::create( spec.logging_factory_name.c_str(), ::dsn::PROVIDER_TYPE_MAIN, spec.dir_log.c_str()); - _memory = factory_store::create(spec.memory_factory_name.c_str(), - ::dsn::PROVIDER_TYPE_MAIN); perf_counters::instance().register_factory( factory_store::get_factory( diff --git a/src/core/core/service_engine.h b/src/core/core/service_engine.h index e523deb4bd..3e05df1016 100644 --- a/src/core/core/service_engine.h +++ b/src/core/core/service_engine.h @@ -53,7 +53,6 @@ class disk_engine; class env_provider; class logging_provider; class nfs_node; -class memory_provider; class task_queue; class task_worker_pool; class timer_service; @@ -146,7 +145,6 @@ class service_engine : public utils::singleton const service_spec &spec() const { return _spec; } env_provider *env() const { return _env; } logging_provider *logging() const { return _logging; } - memory_provider *memory() const { return _memory; } static std::string get_runtime_info(const std::vector &args); static std::string get_queue_info(const std::vector &args); @@ -166,7 +164,6 @@ class service_engine : public utils::singleton service_spec _spec; env_provider *_env; logging_provider *_logging; - memory_provider *_memory; // typedef std::map diff --git a/src/core/core/tool_api.cpp b/src/core/core/tool_api.cpp index 961dcbc6c2..97968d6a93 100644 --- a/src/core/core/tool_api.cpp +++ b/src/core/core/tool_api.cpp @@ -214,13 +214,6 @@ bool register_component_provider(const char *name, return dsn::utils::factory_store::register_factory(name, f, type); } -bool register_component_provider(const char *name, - memory_provider::factory f, - ::dsn::provider_type type) -{ - return dsn::utils::factory_store::register_factory(name, f, type); -} - bool register_component_provider(network_header_format fmt, const std::vector &signatures, message_parser::factory f, diff --git a/src/core/tools/common/nativerun.cpp b/src/core/tools/common/nativerun.cpp index 3aaf2dec98..ea45d75bf3 100644 --- a/src/core/tools/common/nativerun.cpp +++ b/src/core/tools/common/nativerun.cpp @@ -84,12 +84,6 @@ void nativerun::install(service_spec &spec) if (spec.logging_factory_name == "") spec.logging_factory_name = "dsn::tools::simple_logger"; - if (spec.memory_factory_name == "") - spec.memory_factory_name = "dsn::default_memory_provider"; - - if (spec.tools_memory_factory_name == "") - spec.tools_memory_factory_name = "dsn::default_memory_provider"; - if (spec.lock_factory_name == "") spec.lock_factory_name = ("dsn::tools::std_lock_provider"); diff --git a/src/core/tools/common/providers.common.cpp b/src/core/tools/common/providers.common.cpp index b00ccc9c10..9af0494b80 100644 --- a/src/core/tools/common/providers.common.cpp +++ b/src/core/tools/common/providers.common.cpp @@ -56,7 +56,6 @@ namespace tools { void register_common_providers() { register_component_provider("dsn::env_provider"); - register_component_provider("dsn::default_memory_provider"); register_component_provider("dsn::task_worker"); register_component_provider("dsn::tools::screen_logger"); register_component_provider("dsn::tools::simple_logger"); diff --git a/src/core/tools/hpc/fastrun.cpp b/src/core/tools/hpc/fastrun.cpp index 3f7c25136e..33235c7368 100644 --- a/src/core/tools/hpc/fastrun.cpp +++ b/src/core/tools/hpc/fastrun.cpp @@ -96,12 +96,6 @@ void fastrun::install(service_spec &spec) if (spec.logging_factory_name == "") spec.logging_factory_name = "dsn::tools::hpc_logger"; - if (spec.memory_factory_name == "") - spec.memory_factory_name = "dsn::default_memory_provider"; - - if (spec.tools_memory_factory_name == "") - spec.tools_memory_factory_name = "dsn::default_memory_provider"; - if (spec.lock_factory_name == "") spec.lock_factory_name = ("dsn::tools::std_lock_provider"); diff --git a/src/core/tools/simulator/simulator.cpp b/src/core/tools/simulator/simulator.cpp index 6e721c8943..9ae610507a 100644 --- a/src/core/tools/simulator/simulator.cpp +++ b/src/core/tools/simulator/simulator.cpp @@ -92,12 +92,6 @@ void simulator::install(service_spec &spec) if (spec.logging_factory_name == "") spec.logging_factory_name = "dsn::tools::simple_logger"; - if (spec.memory_factory_name == "") - spec.memory_factory_name = "dsn::default_memory_provider"; - - if (spec.tools_memory_factory_name == "") - spec.tools_memory_factory_name = "dsn::default_memory_provider"; - if (spec.lock_factory_name == "") spec.lock_factory_name = ("dsn::tools::sim_lock_provider");