Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
4d234861
Commit
4d234861
authored
Oct 02, 2013
by
Zardosht Kasheff
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
closes #77, remove tabs from memory.cc
parent
bbee1fec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
20 deletions
+20
-20
portability/memory.cc
portability/memory.cc
+20
-20
No files found.
portability/memory.cc
View file @
4d234861
...
@@ -192,12 +192,12 @@ my_malloc_usable_size(void *p) {
...
@@ -192,12 +192,12 @@ my_malloc_usable_size(void *p) {
static
inline
void
static
inline
void
set_max
(
uint64_t
sum_used
,
uint64_t
sum_freed
)
{
set_max
(
uint64_t
sum_used
,
uint64_t
sum_freed
)
{
if
(
sum_used
>=
sum_freed
)
{
if
(
sum_used
>=
sum_freed
)
{
uint64_t
in_use
=
sum_used
-
sum_freed
;
uint64_t
in_use
=
sum_used
-
sum_freed
;
uint64_t
old_max
;
uint64_t
old_max
;
do
{
do
{
old_max
=
status
.
max_in_use
;
old_max
=
status
.
max_in_use
;
}
while
(
old_max
<
in_use
&&
}
while
(
old_max
<
in_use
&&
!
toku_sync_bool_compare_and_swap
(
&
status
.
max_in_use
,
old_max
,
in_use
));
!
toku_sync_bool_compare_and_swap
(
&
status
.
max_in_use
,
old_max
,
in_use
));
}
}
}
}
...
@@ -206,14 +206,14 @@ toku_memory_footprint(void * p, size_t touched) {
...
@@ -206,14 +206,14 @@ toku_memory_footprint(void * p, size_t touched) {
size_t
rval
=
0
;
size_t
rval
=
0
;
size_t
pagesize
=
toku_os_get_pagesize
();
size_t
pagesize
=
toku_os_get_pagesize
();
if
(
p
)
{
if
(
p
)
{
size_t
usable
=
my_malloc_usable_size
(
p
);
size_t
usable
=
my_malloc_usable_size
(
p
);
if
(
usable
>=
status
.
mmap_threshold
)
{
if
(
usable
>=
status
.
mmap_threshold
)
{
int
num_pages
=
(
touched
+
pagesize
)
/
pagesize
;
int
num_pages
=
(
touched
+
pagesize
)
/
pagesize
;
rval
=
num_pages
*
pagesize
;
rval
=
num_pages
*
pagesize
;
}
}
else
{
else
{
rval
=
usable
;
rval
=
usable
;
}
}
}
}
return
rval
;
return
rval
;
}
}
...
@@ -222,7 +222,7 @@ void *
...
@@ -222,7 +222,7 @@ void *
toku_malloc
(
size_t
size
)
{
toku_malloc
(
size_t
size
)
{
void
*
p
=
t_malloc
?
t_malloc
(
size
)
:
os_malloc
(
size
);
void
*
p
=
t_malloc
?
t_malloc
(
size
)
:
os_malloc
(
size
);
if
(
p
)
{
if
(
p
)
{
TOKU_ANNOTATE_NEW_MEMORY
(
p
,
size
);
// see #4671 and https://bugs.kde.org/show_bug.cgi?id=297147
TOKU_ANNOTATE_NEW_MEMORY
(
p
,
size
);
// see #4671 and https://bugs.kde.org/show_bug.cgi?id=297147
if
(
toku_memory_do_stats
)
{
if
(
toku_memory_do_stats
)
{
size_t
used
=
my_malloc_usable_size
(
p
);
size_t
used
=
my_malloc_usable_size
(
p
);
toku_sync_add_and_fetch
(
&
status
.
malloc_count
,
1
);
toku_sync_add_and_fetch
(
&
status
.
malloc_count
,
1
);
...
@@ -239,7 +239,7 @@ toku_malloc(size_t size) {
...
@@ -239,7 +239,7 @@ toku_malloc(size_t size) {
void
*
toku_malloc_aligned
(
size_t
alignment
,
size_t
size
)
{
void
*
toku_malloc_aligned
(
size_t
alignment
,
size_t
size
)
{
void
*
p
=
t_malloc_aligned
?
t_malloc_aligned
(
alignment
,
size
)
:
os_malloc_aligned
(
alignment
,
size
);
void
*
p
=
t_malloc_aligned
?
t_malloc_aligned
(
alignment
,
size
)
:
os_malloc_aligned
(
alignment
,
size
);
if
(
p
)
{
if
(
p
)
{
TOKU_ANNOTATE_NEW_MEMORY
(
p
,
size
);
// see #4671 and https://bugs.kde.org/show_bug.cgi?id=297147
TOKU_ANNOTATE_NEW_MEMORY
(
p
,
size
);
// see #4671 and https://bugs.kde.org/show_bug.cgi?id=297147
if
(
toku_memory_do_stats
)
{
if
(
toku_memory_do_stats
)
{
size_t
used
=
my_malloc_usable_size
(
p
);
size_t
used
=
my_malloc_usable_size
(
p
);
toku_sync_add_and_fetch
(
&
status
.
malloc_count
,
1
);
toku_sync_add_and_fetch
(
&
status
.
malloc_count
,
1
);
...
@@ -275,7 +275,7 @@ toku_realloc(void *p, size_t size) {
...
@@ -275,7 +275,7 @@ toku_realloc(void *p, size_t size) {
set_max
(
status
.
used
,
status
.
freed
);
set_max
(
status
.
used
,
status
.
freed
);
}
}
}
else
{
}
else
{
toku_sync_add_and_fetch
(
&
status
.
realloc_fail
,
1
);
toku_sync_add_and_fetch
(
&
status
.
realloc_fail
,
1
);
}
}
return
q
;
return
q
;
}
}
...
@@ -293,7 +293,7 @@ void *toku_realloc_aligned(size_t alignment, void *p, size_t size) {
...
@@ -293,7 +293,7 @@ void *toku_realloc_aligned(size_t alignment, void *p, size_t size) {
set_max
(
status
.
used
,
status
.
freed
);
set_max
(
status
.
used
,
status
.
freed
);
}
}
}
else
{
}
else
{
toku_sync_add_and_fetch
(
&
status
.
realloc_fail
,
1
);
toku_sync_add_and_fetch
(
&
status
.
realloc_fail
,
1
);
}
}
return
q
;
return
q
;
}
}
...
@@ -319,10 +319,10 @@ toku_free(void *p) {
...
@@ -319,10 +319,10 @@ toku_free(void *p) {
toku_sync_add_and_fetch
(
&
status
.
free_count
,
1
);
toku_sync_add_and_fetch
(
&
status
.
free_count
,
1
);
toku_sync_add_and_fetch
(
&
status
.
freed
,
used
);
toku_sync_add_and_fetch
(
&
status
.
freed
,
used
);
}
}
if
(
t_free
)
if
(
t_free
)
t_free
(
p
);
t_free
(
p
);
else
else
os_free
(
p
);
os_free
(
p
);
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment