Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
828f4e1d
C
ClickHouse
项目概览
2dot5
/
ClickHouse
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
ClickHouse
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
828f4e1d
编写于
7月 15, 2019
作者:
P
proller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix freebsd build
上级
8345509a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
32 addition
and
2 deletion
+32
-2
dbms/src/Common/Arena.h
dbms/src/Common/Arena.h
+25
-1
dbms/src/Common/ArenaWithFreeLists.h
dbms/src/Common/ArenaWithFreeLists.h
+7
-1
未找到文件。
dbms/src/Common/Arena.h
浏览文件 @
828f4e1d
...
...
@@ -5,7 +5,9 @@
#include <vector>
#include <boost/noncopyable.hpp>
#include <common/likely.h>
#include <sanitizer/asan_interface.h>
#if __has_include(<sanitizer/asan_interface.h>)
# include <sanitizer/asan_interface.h>
#endif
#include <Core/Defines.h>
#include <Common/memcpySmall.h>
#include <Common/ProfileEvents.h>
...
...
@@ -55,7 +57,9 @@ private:
end
=
begin
+
size_
-
pad_right
;
prev
=
prev_
;
#if __has_include(<sanitizer/asan_interface.h>)
ASAN_POISON_MEMORY_REGION
(
begin
,
size_
);
#endif
}
~
Chunk
()
...
...
@@ -64,7 +68,9 @@ private:
/// because the allocator might not have asan integration, and the
/// memory would stay poisoned forever. If the allocator supports
/// asan, it will correctly poison the memory by itself.
#if __has_include(<sanitizer/asan_interface.h>)
ASAN_UNPOISON_MEMORY_REGION
(
begin
,
size
());
#endif
Allocator
<
false
>::
free
(
begin
,
size
());
...
...
@@ -135,7 +141,11 @@ public:
char
*
res
=
head
->
pos
;
head
->
pos
+=
size
;
#if __has_include(<sanitizer/asan_interface.h>)
ASAN_UNPOISON_MEMORY_REGION
(
res
,
size
+
pad_right
);
#endif
return
res
;
}
...
...
@@ -152,7 +162,11 @@ public:
{
head
->
pos
=
static_cast
<
char
*>
(
head_pos
);
head
->
pos
+=
size
;
#if __has_include(<sanitizer/asan_interface.h>)
ASAN_UNPOISON_MEMORY_REGION
(
res
,
size
+
pad_right
);
#endif
return
res
;
}
...
...
@@ -172,7 +186,9 @@ public:
void
rollback
(
size_t
size
)
{
head
->
pos
-=
size
;
#if __has_include(<sanitizer/asan_interface.h>)
ASAN_POISON_MEMORY_REGION
(
head
->
pos
,
size
+
pad_right
);
#endif
}
/** Begin or expand allocation of contiguous piece of memory without alignment.
...
...
@@ -199,7 +215,9 @@ public:
if
(
!
begin
)
begin
=
res
;
#if __has_include(<sanitizer/asan_interface.h>)
ASAN_UNPOISON_MEMORY_REGION
(
res
,
size
+
pad_right
);
#endif
return
res
;
}
...
...
@@ -232,7 +250,9 @@ public:
if
(
!
begin
)
begin
=
res
;
#if __has_include(<sanitizer/asan_interface.h>)
ASAN_UNPOISON_MEMORY_REGION
(
res
,
size
+
pad_right
);
#endif
return
res
;
}
...
...
@@ -243,7 +263,9 @@ public:
if
(
old_data
)
{
memcpy
(
res
,
old_data
,
old_size
);
#if __has_include(<sanitizer/asan_interface.h>)
ASAN_POISON_MEMORY_REGION
(
old_data
,
old_size
);
#endif
}
return
res
;
}
...
...
@@ -254,7 +276,9 @@ public:
if
(
old_data
)
{
memcpy
(
res
,
old_data
,
old_size
);
#if __has_include(<sanitizer/asan_interface.h>)
ASAN_POISON_MEMORY_REGION
(
old_data
,
old_size
);
#endif
}
return
res
;
}
...
...
dbms/src/Common/ArenaWithFreeLists.h
浏览文件 @
828f4e1d
#pragma once
#include <sanitizer/asan_interface.h>
#if __has_include(<sanitizer/asan_interface.h>)
# include <sanitizer/asan_interface.h>
#endif
#include <Common/Arena.h>
#include <Common/BitHelpers.h>
...
...
@@ -68,8 +70,10 @@ public:
/// item in the list. We poisoned the free block before putting
/// it into the free list, so we have to unpoison it before
/// reading anything.
#if __has_include(<sanitizer/asan_interface.h>)
ASAN_UNPOISON_MEMORY_REGION
(
free_block_ptr
,
std
::
max
(
size
,
sizeof
(
Block
)));
#endif
const
auto
res
=
free_block_ptr
->
data
;
free_block_ptr
=
free_block_ptr
->
next
;
...
...
@@ -100,7 +104,9 @@ public:
/// destructor, to support an underlying allocator that doesn't
/// integrate with asan. We don't do that, and rely on the fact that
/// our underlying allocator is Arena, which does have asan integration.
#if __has_include(<sanitizer/asan_interface.h>)
ASAN_POISON_MEMORY_REGION
(
ptr
,
1ULL
<<
(
list_idx
+
1
));
#endif
}
/// Size of the allocated pool in bytes
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录