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
ec0f506a
Commit
ec0f506a
authored
Jan 22, 2002
by
serg@serg.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Framework to simplify memory leak tracing
parent
5c1da273
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
11 deletions
+22
-11
include/hash.h
include/hash.h
+3
-2
include/my_sys.h
include/my_sys.h
+12
-2
mysys/array.c
mysys/array.c
+4
-4
mysys/hash.c
mysys/hash.c
+3
-3
No files found.
include/hash.h
View file @
ec0f506a
...
...
@@ -44,9 +44,10 @@ typedef struct st_hash {
uint
(
*
calc_hashnr
)(
const
byte
*
key
,
uint
length
);
}
HASH
;
my_bool
hash_init
(
HASH
*
hash
,
uint
default_array_elements
,
uint
key_offset
,
#define hash_init(A,B,C,D,E,F,G) _hash_init(A,B,C,D,E,F,G CALLER_INFO)
my_bool
_hash_init
(
HASH
*
hash
,
uint
default_array_elements
,
uint
key_offset
,
uint
key_length
,
hash_get_key
get_key
,
void
(
*
free_element
)(
void
*
),
uint
flags
);
void
(
*
free_element
)(
void
*
),
uint
flags
CALLER_INFO_PROTO
);
void
hash_free
(
HASH
*
tree
);
byte
*
hash_element
(
HASH
*
hash
,
uint
idx
);
gptr
hash_search
(
HASH
*
info
,
const
byte
*
key
,
uint
length
);
...
...
include/my_sys.h
View file @
ec0f506a
...
...
@@ -115,6 +115,7 @@ extern int NEAR my_errno; /* Last error in mysys */
#ifdef SAFEMALLOC
#define my_malloc(SZ,FLAG) _mymalloc( SZ, __FILE__, __LINE__, FLAG )
#define my_malloc_ci(SZ,FLAG) _mymalloc( SZ, sFile, uLine, FLAG )
#define my_realloc(PTR,SZ,FLAG) _myrealloc( PTR, SZ, __FILE__, __LINE__, FLAG )
#define my_checkmalloc() _sanity( __FILE__, __LINE__ )
#define my_free(PTR,FLAG) _myfree( PTR, __FILE__, __LINE__,FLAG)
...
...
@@ -124,6 +125,9 @@ extern int NEAR my_errno; /* Last error in mysys */
#define NORMAL_SAFEMALLOC sf_malloc_quick=0
extern
uint
sf_malloc_prehunc
,
sf_malloc_endhunc
,
sf_malloc_quick
;
extern
ulonglong
safemalloc_mem_limit
;
#define CALLER_INFO_PROTO , const char *sFile, uint uLine
#define CALLER_INFO , __FILE__, __LINE__
#define ORIG_CALLER_INFO , sFile, uLine
#else
#define my_checkmalloc() (0)
#undef TERMINATE
...
...
@@ -131,11 +135,15 @@ extern ulonglong safemalloc_mem_limit;
#define QUICK_SAFEMALLOC
#define NORMAL_SAFEMALLOC
extern
gptr
my_malloc
(
uint
Size
,
myf
MyFlags
);
#define my_malloc_ci(SZ,FLAG) my_malloc( SZ, FLAG )
extern
gptr
my_realloc
(
gptr
oldpoint
,
uint
Size
,
myf
MyFlags
);
extern
void
my_no_flags_free
(
gptr
ptr
);
extern
gptr
my_memdup
(
const
byte
*
from
,
uint
length
,
myf
MyFlags
);
extern
my_string
my_strdup
(
const
char
*
from
,
myf
MyFlags
);
#define my_free(PTR,FG) my_no_flags_free(PTR)
#define CALLER_INFO_PROTO
/* nothing */
#define CALLER_INFO
/* nothing */
#define ORIG_CALLER_INFO
/* nothing */
#endif
#ifdef HAVE_ALLOCA
#define my_alloca(SZ) alloca((size_t) (SZ))
...
...
@@ -541,8 +549,10 @@ extern my_bool real_open_cached_file(IO_CACHE *cache);
extern
void
close_cached_file
(
IO_CACHE
*
cache
);
File
create_temp_file
(
char
*
to
,
const
char
*
dir
,
const
char
*
pfx
,
int
mode
,
myf
MyFlags
);
extern
my_bool
init_dynamic_array
(
DYNAMIC_ARRAY
*
array
,
uint
element_size
,
uint
init_alloc
,
uint
alloc_increment
);
#define init_dynamic_array(A,B,C,D) _init_dynamic_array(A,B,C,D CALLER_INFO)
#define init_dynamic_array_ci(A,B,C,D) _init_dynamic_array(A,B,C,D ORIG_CALLER_INFO)
extern
my_bool
_init_dynamic_array
(
DYNAMIC_ARRAY
*
array
,
uint
element_size
,
uint
init_alloc
,
uint
alloc_increment
CALLER_INFO_PROTO
);
extern
my_bool
insert_dynamic
(
DYNAMIC_ARRAY
*
array
,
gptr
element
);
extern
byte
*
alloc_dynamic
(
DYNAMIC_ARRAY
*
array
);
extern
byte
*
pop_dynamic
(
DYNAMIC_ARRAY
*
);
...
...
mysys/array.c
View file @
ec0f506a
...
...
@@ -29,8 +29,8 @@
even if space allocation failed
*/
my_bool
init_dynamic_array
(
DYNAMIC_ARRAY
*
array
,
uint
element_size
,
uint
init_alloc
,
uint
alloc_increment
)
my_bool
_
init_dynamic_array
(
DYNAMIC_ARRAY
*
array
,
uint
element_size
,
uint
init_alloc
,
uint
alloc_increment
CALLER_INFO_PROTO
)
{
DBUG_ENTER
(
"init_dynamic_array"
);
if
(
!
alloc_increment
)
...
...
@@ -46,7 +46,7 @@ my_bool init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size,
array
->
max_element
=
init_alloc
;
array
->
alloc_increment
=
alloc_increment
;
array
->
size_of_element
=
element_size
;
if
(
!
(
array
->
buffer
=
(
char
*
)
my_malloc
(
element_size
*
init_alloc
,
MYF
(
MY_WME
))))
if
(
!
(
array
->
buffer
=
(
char
*
)
my_malloc
_ci
(
element_size
*
init_alloc
,
MYF
(
MY_WME
))))
{
array
->
max_element
=
0
;
DBUG_RETURN
(
TRUE
);
...
...
mysys/hash.c
View file @
ec0f506a
...
...
@@ -37,15 +37,15 @@ static uint calc_hashnr_caseup(const byte *key,uint length);
static
int
hashcmp
(
HASH
*
hash
,
HASH_LINK
*
pos
,
const
byte
*
key
,
uint
length
);
my_bool
hash_init
(
HASH
*
hash
,
uint
size
,
uint
key_offset
,
uint
key_length
,
my_bool
_
hash_init
(
HASH
*
hash
,
uint
size
,
uint
key_offset
,
uint
key_length
,
hash_get_key
get_key
,
void
(
*
free_element
)(
void
*
),
uint
flags
)
void
(
*
free_element
)(
void
*
),
uint
flags
CALLER_INFO_PROTO
)
{
DBUG_ENTER
(
"hash_init"
);
DBUG_PRINT
(
"enter"
,(
"hash: %lx size: %d"
,
hash
,
size
));
hash
->
records
=
0
;
if
(
init_dynamic_array
(
&
hash
->
array
,
sizeof
(
HASH_LINK
),
size
,
0
))
if
(
init_dynamic_array
_ci
(
&
hash
->
array
,
sizeof
(
HASH_LINK
),
size
,
0
))
{
hash
->
free
=
0
;
/* Allow call to hash_free */
DBUG_RETURN
(
TRUE
);
...
...
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