mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Merge pull request #17412 from nikitamikhaylov/radix-malloc
Replaced malloc with new in RadixSort
This commit is contained in:
commit
1724f182e6
@ -114,7 +114,7 @@ class QuantileTDigest
|
||||
static constexpr size_t PART_SIZE_BITS = 8;
|
||||
|
||||
using Transform = RadixSortFloatTransform<KeyBits>;
|
||||
using Allocator = RadixSortMallocAllocator;
|
||||
using Allocator = RadixSortAllocator;
|
||||
|
||||
/// The function to get the key from an array element.
|
||||
static Key & extractKey(Element & elem) { return elem.mean; }
|
||||
|
@ -35,16 +35,16 @@
|
||||
|
||||
/** Used as a template parameter. See below.
|
||||
*/
|
||||
struct RadixSortMallocAllocator
|
||||
struct RadixSortAllocator
|
||||
{
|
||||
void * allocate(size_t size)
|
||||
{
|
||||
return malloc(size);
|
||||
return ::operator new(size);
|
||||
}
|
||||
|
||||
void deallocate(void * ptr, size_t /*size*/)
|
||||
void deallocate(void * ptr, size_t size)
|
||||
{
|
||||
return free(ptr);
|
||||
::operator delete(ptr, size);
|
||||
}
|
||||
};
|
||||
|
||||
@ -100,7 +100,7 @@ struct RadixSortFloatTraits
|
||||
/// An object with the functions allocate and deallocate.
|
||||
/// Can be used, for example, to allocate memory for a temporary array on the stack.
|
||||
/// To do this, the allocator itself is created on the stack.
|
||||
using Allocator = RadixSortMallocAllocator;
|
||||
using Allocator = RadixSortAllocator;
|
||||
|
||||
/// The function to get the key from an array element.
|
||||
static Key & extractKey(Element & elem) { return elem; }
|
||||
@ -139,7 +139,7 @@ struct RadixSortUIntTraits
|
||||
static constexpr size_t PART_SIZE_BITS = 8;
|
||||
|
||||
using Transform = RadixSortIdentityTransform<KeyBits>;
|
||||
using Allocator = RadixSortMallocAllocator;
|
||||
using Allocator = RadixSortAllocator;
|
||||
|
||||
static Key & extractKey(Element & elem) { return elem; }
|
||||
static Result & extractResult(Element & elem) { return elem; }
|
||||
@ -173,7 +173,7 @@ struct RadixSortIntTraits
|
||||
static constexpr size_t PART_SIZE_BITS = 8;
|
||||
|
||||
using Transform = RadixSortSignedTransform<KeyBits>;
|
||||
using Allocator = RadixSortMallocAllocator;
|
||||
using Allocator = RadixSortAllocator;
|
||||
|
||||
static Key & extractKey(Element & elem) { return elem; }
|
||||
static Result & extractResult(Element & elem) { return elem; }
|
||||
|
Loading…
Reference in New Issue
Block a user