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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
86e69174
Commit
86e69174
authored
Aug 08, 2007
by
Bradley C. Kuszmaul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Report on how many fresh mallocs
git-svn-id:
file:///svn/tokudb@95
c7de825b-a66e-492c-adef-691d508d4ae1
parent
cb0d0cd2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
newbrt/memory.c
newbrt/memory.c
+7
-4
No files found.
newbrt/memory.c
View file @
86e69174
...
...
@@ -138,8 +138,9 @@ void *toku_calloc(long nmemb, long size) {
void
*
freelist
[
FREELIST_LIMIT
];
#define MALLOC_SIZE_COUNTING_LIMIT 256
int
malloc_counts
[
MALLOC_SIZE_COUNTING_LIMIT
];
int
other_malloc_count
=
0
;
int
malloc_counts
[
MALLOC_SIZE_COUNTING_LIMIT
];
// We rely on static variables being initialized to 0.
int
fresh_malloc_counts
[
MALLOC_SIZE_COUNTING_LIMIT
];
// We rely on static variables being initialized to 0.
int
other_malloc_count
=
0
,
fresh_other_malloc_count
=
0
;
void
*
toku_malloc
(
unsigned
long
size
)
{
void
*
r
;
errno
=
0
;
...
...
@@ -154,6 +155,8 @@ void *toku_malloc(unsigned long size) {
return
r
;
}
}
if
(
size
<
MALLOC_SIZE_COUNTING_LIMIT
)
fresh_malloc_counts
[
size
]
++
;
else
fresh_other_malloc_count
++
;
r
=
actual_malloc
(
size
);
//printf("%s:%d malloc(%ld)->%p\n", __FILE__, __LINE__, size,r);
note_did_malloc
(
r
,
size
);
...
...
@@ -226,9 +229,9 @@ void malloc_report (void) {
int
i
;
printf
(
"malloc report:
\n
"
);
for
(
i
=
0
;
i
<
MALLOC_SIZE_COUNTING_LIMIT
;
i
++
)
{
if
(
malloc_counts
[
i
]
)
printf
(
"%d: %d
\n
"
,
i
,
malloc_counts
[
i
]);
if
(
malloc_counts
[
i
]
||
fresh_malloc_counts
[
i
])
printf
(
"%d: %d (%d fresh)
\n
"
,
i
,
malloc_counts
[
i
],
fresh_
malloc_counts
[
i
]);
}
printf
(
"Other: %d
\n
"
,
other_malloc_count
);
printf
(
"Other: %d
(%d fresh)
\n
"
,
other_malloc_count
,
fresh_
other_malloc_count
);
}
void
malloc_cleanup
(
void
)
{
...
...
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