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
c8f4e208
Commit
c8f4e208
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
a840ce48
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 @
c8f4e208
...
...
@@ -192,12 +192,12 @@ my_malloc_usable_size(void *p) {
static
inline
void
set_max
(
uint64_t
sum_used
,
uint64_t
sum_freed
)
{
if
(
sum_used
>=
sum_freed
)
{
uint64_t
in_use
=
sum_used
-
sum_freed
;
uint64_t
old_max
;
do
{
old_max
=
status
.
max_in_use
;
}
while
(
old_max
<
in_use
&&
!
toku_sync_bool_compare_and_swap
(
&
status
.
max_in_use
,
old_max
,
in_use
));
uint64_t
in_use
=
sum_used
-
sum_freed
;
uint64_t
old_max
;
do
{
old_max
=
status
.
max_in_use
;
}
while
(
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) {
size_t
rval
=
0
;
size_t
pagesize
=
toku_os_get_pagesize
();
if
(
p
)
{
size_t
usable
=
my_malloc_usable_size
(
p
);
if
(
usable
>=
status
.
mmap_threshold
)
{
size_t
usable
=
my_malloc_usable_size
(
p
);
if
(
usable
>=
status
.
mmap_threshold
)
{
int
num_pages
=
(
touched
+
pagesize
)
/
pagesize
;
rval
=
num_pages
*
pagesize
;
}
else
{
rval
=
usable
;
}
}
else
{
rval
=
usable
;
}
}
return
rval
;
}
...
...
@@ -222,7 +222,7 @@ void *
toku_malloc
(
size_t
size
)
{
void
*
p
=
t_malloc
?
t_malloc
(
size
)
:
os_malloc
(
size
);
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
)
{
size_t
used
=
my_malloc_usable_size
(
p
);
toku_sync_add_and_fetch
(
&
status
.
malloc_count
,
1
);
...
...
@@ -239,7 +239,7 @@ toku_malloc(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
);
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
)
{
size_t
used
=
my_malloc_usable_size
(
p
);
toku_sync_add_and_fetch
(
&
status
.
malloc_count
,
1
);
...
...
@@ -275,7 +275,7 @@ toku_realloc(void *p, size_t size) {
set_max
(
status
.
used
,
status
.
freed
);
}
}
else
{
toku_sync_add_and_fetch
(
&
status
.
realloc_fail
,
1
);
toku_sync_add_and_fetch
(
&
status
.
realloc_fail
,
1
);
}
return
q
;
}
...
...
@@ -293,7 +293,7 @@ void *toku_realloc_aligned(size_t alignment, void *p, size_t size) {
set_max
(
status
.
used
,
status
.
freed
);
}
}
else
{
toku_sync_add_and_fetch
(
&
status
.
realloc_fail
,
1
);
toku_sync_add_and_fetch
(
&
status
.
realloc_fail
,
1
);
}
return
q
;
}
...
...
@@ -319,10 +319,10 @@ toku_free(void *p) {
toku_sync_add_and_fetch
(
&
status
.
free_count
,
1
);
toku_sync_add_and_fetch
(
&
status
.
freed
,
used
);
}
if
(
t_free
)
t_free
(
p
);
else
os_free
(
p
);
if
(
t_free
)
t_free
(
p
);
else
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