You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ch...@apache.org on 2019/05/03 19:10:46 UTC

[qpid-dispatch] branch master updated: DISPATCH-1312: Remove USE_MEMORY_POOL cmake option

This is an automated email from the ASF dual-hosted git repository.

chug pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git


The following commit(s) were added to refs/heads/master by this push:
     new 9500b45  DISPATCH-1312: Remove USE_MEMORY_POOL cmake option
9500b45 is described below

commit 9500b454cd304e2f22c101cd99bcb749cadafd70
Author: Chuck Rolke <ch...@apache.org>
AuthorDate: Fri May 3 15:09:23 2019 -0400

    DISPATCH-1312: Remove USE_MEMORY_POOL cmake option
    
    Pools are required.
---
 CMakeLists.txt                       |  2 --
 bin/grinder                          |  2 +-
 include/qpid/dispatch/alloc.h        |  4 ---
 include/qpid/dispatch/alloc_malloc.h | 66 ------------------------------------
 src/CMakeLists.txt                   |  5 +--
 src/config.h.in                      |  1 -
 tests/CMakeLists.txt                 |  4 +--
 tests/run_unit_tests.c               |  2 --
 8 files changed, 3 insertions(+), 83 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 399f5f2..0853c3c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -34,8 +34,6 @@ if (CMAKE_BUILD_TYPE MATCHES "Deb|Cover")
 endif (CMAKE_BUILD_TYPE MATCHES "Deb|Cover")
 message(STATUS "Build type is \"${CMAKE_BUILD_TYPE}\"${has_debug_symbols}")
 
-# Build time switch to turn off memory pooling.
-option(USE_MEMORY_POOL "Use per-thread memory pools" ON)
 option(QD_MEMORY_STATS "Track memory pool usage statistics" ON)
 
 file(STRINGS "${CMAKE_SOURCE_DIR}/VERSION.txt" QPID_DISPATCH_VERSION)
diff --git a/bin/grinder b/bin/grinder
index d06ed8f..9a4aa77 100755
--- a/bin/grinder
+++ b/bin/grinder
@@ -22,7 +22,7 @@
 # a tool for post-processing Valgrind output from the unit tests
 # Use:
 #    1) configure the build to use valgrind and output xml
-#       $ cmake .. -DUSE_VALGRIND=Yes -DVALGRIND_XML=Yes -DUSE_MEMORY_POOL=No
+#       $ cmake .. -DUSE_VALGRIND=Yes -DVALGRIND_XML=Yes
 #    2) build and run the unit tests
 #       $ make && make test
 #    3) run grinder from your build directory.  It will look for valgrind xml
diff --git a/include/qpid/dispatch/alloc.h b/include/qpid/dispatch/alloc.h
index 3ee4566..7b77e02 100644
--- a/include/qpid/dispatch/alloc.h
+++ b/include/qpid/dispatch/alloc.h
@@ -34,10 +34,6 @@
 #define QD_MEMORY_FILL(P,C,S)
 #endif
 
-#if USE_MEMORY_POOL
 #include "alloc_pool.h"
-#else
-#include "alloc_malloc.h"
-#endif
 
 #endif // ALLOC_H
diff --git a/include/qpid/dispatch/alloc_malloc.h b/include/qpid/dispatch/alloc_malloc.h
deleted file mode 100644
index ffc0d84..0000000
--- a/include/qpid/dispatch/alloc_malloc.h
+++ /dev/null
@@ -1,66 +0,0 @@
-#ifndef ALLOC_MALLOC_H
-#define ALLOC_MALLOC_H
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include <stdint.h>
-#include <string.h>
-#include <qpid/dispatch/ctools.h>
-
-/**
- *@file
- *
- * Use simple malloc/free allocation in place of allocation pools.
- * Useful for debugging with tools like valgrind.
- */
-
-typedef struct {
-    void     *ptr;
-    uint32_t  seq;
-} qd_alloc_safe_ptr_t;
-
-#define ALLOC_DECLARE(T)                \
-    T *new_##T(void);                   \
-    void free_##T(T *p);                \
-    typedef qd_alloc_safe_ptr_t T##_sp; \
-    void set_safe_ptr_##T(T *p, T##_sp *sp); \
-    T *safe_deref_##T(T##_sp sp)
-
-#define ALLOC_DEFINE_CONFIG(T,S,A,C)                \
-    T *new_##T(void) { size_t *a = (A);             \
-        T *p = malloc((S)+ (a ? *a : 0));           \
-        QD_MEMORY_FILL(p, QD_MEMORY_INIT, (S) + (a ? *a : 0)); \
-        return p; }                                 \
-    void free_##T(T *p) { size_t *a = (A);          \
-        QD_MEMORY_FILL(p, QD_MEMORY_FREE, (S) + (a ? *a : 0)); \
-        free(p); }                                  \
-    void set_safe_ptr_##T(T *p, T##_sp *sp) { sp->ptr = (void*) p; sp->seq = qd_alloc_sequence((void*) p); } \
-    T *safe_deref_##T(T##_sp sp) { return sp.seq == qd_alloc_sequence((void*) sp.ptr) ? (T*) sp.ptr : (T*) 0; } \
-    void *unused##T
-
-#define ALLOC_DEFINE(T) ALLOC_DEFINE_CONFIG(T, sizeof(T), 0, 0)
-
-static inline uint32_t qd_alloc_sequence(void *p) { return 0; }
-static inline void qd_nullify_safe_ptr(qd_alloc_safe_ptr_t *sp) { }
-static inline void qd_alloc_initialize(void) {}
-static inline void qd_alloc_debug_dump(const char *file) {}
-static inline void qd_alloc_finalize(void) {}
-
-
-#endif // ALLOC_MALLOC_H
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 67983fb..5e7313b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -38,6 +38,7 @@ add_custom_command (
 
 # Build the qpid-dispatch library.
 set(qpid_dispatch_SOURCES
+  alloc_pool.c
   amqp.c
   bitmask.c
   buffer.c
@@ -131,10 +132,6 @@ else(USE_LIBWEBSOCKETS)
   list(APPEND qpid_dispatch_SOURCES http-none.c)
 endif(USE_LIBWEBSOCKETS)
 
-if(USE_MEMORY_POOL)
-  list(APPEND qpid_dispatch_SOURCES alloc_pool.c)
-endif()
-
 # DISPATCH-654 There are, in fact, no strict-aliasing violations and newer compilers don't complain.
 if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
     set_property(
diff --git a/src/config.h.in b/src/config.h.in
index 5cd3e89..fb4ade9 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -20,5 +20,4 @@
 #define QPID_DISPATCH_VERSION "${QPID_DISPATCH_VERSION}"
 #define QPID_DISPATCH_LIB "$<TARGET_FILE_NAME:qpid-dispatch>"
 #define QPID_CONSOLE_STAND_ALONE_INSTALL_DIR "${CONSOLE_STAND_ALONE_INSTALL_DIR}"
-#cmakedefine01 USE_MEMORY_POOL
 #cmakedefine01 QD_MEMORY_STATS
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index e76c81c..9fa941e 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -35,10 +35,8 @@ set(unit_test_SOURCES
     core_timer_test.c
     parse_tree_tests.c
     proton_utils_tests.c
+    alloc_test.c
     )
-if (USE_MEMORY_POOL)
-  list(APPEND unit_test_SOURCES alloc_test.c)
-endif()
 
 add_executable(unit_tests ${unit_test_SOURCES})
 target_link_libraries(unit_tests qpid-dispatch)
diff --git a/tests/run_unit_tests.c b/tests/run_unit_tests.c
index 77b9845..a944b43 100644
--- a/tests/run_unit_tests.c
+++ b/tests/run_unit_tests.c
@@ -57,9 +57,7 @@ int main(int argc, char** argv)
     result += timer_tests(qd);
     result += tool_tests();
     result += compose_tests();
-#if USE_MEMORY_POOL
     result += alloc_tests();
-#endif
     result += policy_tests();
     result += failoverlist_tests();
     result += parse_tree_tests();


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org