From 69f2911e04ffb1b19eef1fafb8c040af271f656e Mon Sep 17 00:00:00 2001 From: Tor Aamodt Date: Thu, 15 Jul 2010 18:09:46 -0800 Subject: creating branch for adding support for CUDA 3.x and Fermi [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 6829] --- benchmarks/CUDA/MUM/PoolMalloc.hh | 53 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 benchmarks/CUDA/MUM/PoolMalloc.hh (limited to 'benchmarks/CUDA/MUM/PoolMalloc.hh') diff --git a/benchmarks/CUDA/MUM/PoolMalloc.hh b/benchmarks/CUDA/MUM/PoolMalloc.hh new file mode 100644 index 0000000..8fb7733 --- /dev/null +++ b/benchmarks/CUDA/MUM/PoolMalloc.hh @@ -0,0 +1,53 @@ +//////////////////////////////////////////////////////////////////////////////// +//! \file +//! \author Adam M Phillippy +//! \date 09/22/2006 +//! +//! \brief PoolMalloc_t header file +//! +//////////////////////////////////////////////////////////////////////////////// + +#ifndef POOLMALLOC_HH +#define POOLMALLOC_HH + +#include + +struct PoolNode_t; + +//============================================================ PoolMalloc_t ==== +/** \brief Class for allocating memory from a pool + ** Manage memory in pools to speed up allocation of many short strings or + ** arrays. + ** + ** All of the arrays/strings allocated from a given PoolMalloc_t object + ** should share the same lifetime, since they will all be free'd when the + ** object is destroyed. + **/ + +class PoolMalloc_t +{ + +public: + /// Initialize the pool + PoolMalloc_t(); + + /// Free all of the memory associated with this object + ~PoolMalloc_t(); + + /// Explicitly free all of the memory associated with this object + void pfree(); + + /// Allocate an array from the pool + void * pmalloc(size_t size); + + /// Copy a string using memory from the pool + char * pstrdup(const char *s); + +private: + + PoolNode_t *head_m; + +}; + + +#endif // POOLMALLOC_HH -- cgit v1.3