projects
/
folly.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
An intro to the upgrade mutex in the Synchronized docs
[folly.git]
/
folly
/
Arena.h
diff --git
a/folly/Arena.h
b/folly/Arena.h
index 3aeffc33575317345fb65098df7ae5681b499d92..8b928b039d01febacbcc9596338b13fcbcd466d8 100644
(file)
--- a/
folly/Arena.h
+++ b/
folly/Arena.h
@@
-1,5
+1,5
@@
/*
/*
- * Copyright 201
4
Facebook, Inc.
+ * Copyright 201
6
Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@
-14,7
+14,7
@@
* limitations under the License.
*/
* limitations under the License.
*/
-#
ifndef FOLLY_ARENA_H_
+#
pragma once
#define FOLLY_ARENA_H_
#include <cassert>
#define FOLLY_ARENA_H_
#include <cassert>
@@
-99,7
+99,7
@@
class Arena {
return r;
}
return r;
}
- void deallocate(void*
p
) {
+ void deallocate(void*
/* p */
) {
// Deallocate? Never!
}
// Deallocate? Never!
}
@@
-119,7
+119,6
@@
class Arena {
return bytesUsed_;
}
return bytesUsed_;
}
- private:
// not copyable
Arena(const Arena&) = delete;
Arena& operator=(const Arena&) = delete;
// not copyable
Arena(const Arena&) = delete;
Arena& operator=(const Arena&) = delete;
@@
-128,11
+127,12
@@
class Arena {
Arena(Arena&&) = default;
Arena& operator=(Arena&&) = default;
Arena(Arena&&) = default;
Arena& operator=(Arena&&) = default;
+ private:
struct Block;
typedef boost::intrusive::slist_member_hook<
boost::intrusive::tag<Arena>> BlockLink;
struct Block;
typedef boost::intrusive::slist_member_hook<
boost::intrusive::tag<Arena>> BlockLink;
- struct Block {
+ struct
FOLLY_ALIGNED_MAX
Block {
BlockLink link;
// Allocate a block with at least size bytes of storage.
BlockLink link;
// Allocate a block with at least size bytes of storage.
@@
-148,11
+148,9
@@
class Arena {
}
private:
}
private:
- Block() { }
- ~Block() { }
- } __attribute__((__aligned__));
- // This should be alignas(std::max_align_t) but neither alignas nor
- // max_align_t are supported by gcc 4.6.2.
+ Block() = default;
+ ~Block() = default;
+ };
public:
static constexpr size_t kDefaultMinBlockSize = 4096 - sizeof(Block);
public:
static constexpr size_t kDefaultMinBlockSize = 4096 - sizeof(Block);
@@
-217,14
+215,12
@@
struct IsArenaAllocator<Arena<Alloc>> : std::true_type { };
*/
template <class Alloc>
struct ArenaAllocatorTraits {
*/
template <class Alloc>
struct ArenaAllocatorTraits {
- static size_t goodSize(const Alloc& alloc, size_t size) {
- return size;
- }
+ static size_t goodSize(const Alloc& /* alloc */, size_t size) { return size; }
};
template <>
struct ArenaAllocatorTraits<SysAlloc> {
};
template <>
struct ArenaAllocatorTraits<SysAlloc> {
- static size_t goodSize(const SysAlloc&
alloc
, size_t size) {
+ static size_t goodSize(const SysAlloc&
/* alloc */
, size_t size) {
return goodMallocSize(size);
}
};
return goodMallocSize(size);
}
};
@@
-247,5
+243,3
@@
struct IsArenaAllocator<SysArena> : std::true_type { };
} // namespace folly
#include <folly/Arena-inl.h>
} // namespace folly
#include <folly/Arena-inl.h>
-
-#endif /* FOLLY_ARENA_H_ */