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
ecdb1c76
Commit
ecdb1c76
authored
Jun 12, 2003
by
monty@narttu.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed safemalloc structure to not have to be 8 byte aligned. (Portability problem)
parent
a79bdf2e
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
173 additions
and
188 deletions
+173
-188
include/my_sys.h
include/my_sys.h
+2
-2
mysys/default.c
mysys/default.c
+0
-2
mysys/my_static.c
mysys/my_static.c
+5
-6
mysys/my_static.h
mysys/my_static.h
+14
-18
mysys/safemalloc.c
mysys/safemalloc.c
+148
-157
sql/mysqld.cc
sql/mysqld.cc
+1
-1
sql/sql_parse.cc
sql/sql_parse.cc
+3
-2
No files found.
include/my_sys.h
View file @
ecdb1c76
...
@@ -138,7 +138,7 @@ extern int NEAR my_errno; /* Last error in mysys */
...
@@ -138,7 +138,7 @@ extern int NEAR my_errno; /* Last error in mysys */
#define QUICK_SAFEMALLOC sf_malloc_quick=1
#define QUICK_SAFEMALLOC sf_malloc_quick=1
#define NORMAL_SAFEMALLOC sf_malloc_quick=0
#define NORMAL_SAFEMALLOC sf_malloc_quick=0
extern
uint
sf_malloc_prehunc
,
sf_malloc_endhunc
,
sf_malloc_quick
;
extern
uint
sf_malloc_prehunc
,
sf_malloc_endhunc
,
sf_malloc_quick
;
extern
ulonglong
s
afe
malloc_mem_limit
;
extern
ulonglong
s
f_
malloc_mem_limit
;
#define CALLER_INFO_PROTO , const char *sFile, uint uLine
#define CALLER_INFO_PROTO , const char *sFile, uint uLine
#define CALLER_INFO , __FILE__, __LINE__
#define CALLER_INFO , __FILE__, __LINE__
...
@@ -239,7 +239,7 @@ extern int NEAR my_umask, /* Default creation mask */
...
@@ -239,7 +239,7 @@ extern int NEAR my_umask, /* Default creation mask */
NEAR
my_safe_to_handle_signal
,
/* Set when allowed to SIGTSTP */
NEAR
my_safe_to_handle_signal
,
/* Set when allowed to SIGTSTP */
NEAR
my_dont_interrupt
;
/* call remember_intr when set */
NEAR
my_dont_interrupt
;
/* call remember_intr when set */
extern
my_bool
NEAR
mysys_uses_curses
,
my_use_symdir
;
extern
my_bool
NEAR
mysys_uses_curses
,
my_use_symdir
;
extern
long
lCurMemory
,
lMaxMemory
;
/* from safemalloc */
extern
ulong
sf_malloc_cur_memory
,
sf_malloc_max_memory
;
extern
ulong
my_default_record_cache_size
;
extern
ulong
my_default_record_cache_size
;
extern
my_bool
NEAR
my_disable_locking
,
NEAR
my_disable_async_io
,
extern
my_bool
NEAR
my_disable_locking
,
NEAR
my_disable_async_io
,
...
...
mysys/default.c
View file @
ecdb1c76
...
@@ -33,8 +33,6 @@
...
@@ -33,8 +33,6 @@
** --print-defaults ; Print the modified command line and exit
** --print-defaults ; Print the modified command line and exit
****************************************************************************/
****************************************************************************/
#undef SAFEMALLOC
/* safe_malloc is not yet initailized */
#include "mysys_priv.h"
#include "mysys_priv.h"
#include "m_string.h"
#include "m_string.h"
#include "m_ctype.h"
#include "m_ctype.h"
...
...
mysys/my_static.c
View file @
ecdb1c76
...
@@ -69,14 +69,13 @@ uint sf_malloc_prehunc=0, /* If you have problem with core- */
...
@@ -69,14 +69,13 @@ uint sf_malloc_prehunc=0, /* If you have problem with core- */
sf_malloc_endhunc
=
0
,
/* dump when malloc-message.... */
sf_malloc_endhunc
=
0
,
/* dump when malloc-message.... */
/* set theese to 64 or 128 */
/* set theese to 64 or 128 */
sf_malloc_quick
=
0
;
/* set if no calls to sanity */
sf_malloc_quick
=
0
;
/* set if no calls to sanity */
long
lCurMemory
=
0L
;
/* Current memory usage */
ulong
sf_malloc_cur_memory
=
0L
;
/* Current memory usage */
long
lMaxMemory
=
0L
;
/* Maximum memory usage */
ulong
sf_malloc_max_memory
=
0L
;
/* Maximum memory usage */
uint
cNewCount
=
0
;
/* Number of times NEW() was called */
uint
sf_malloc_count
=
0
;
/* Number of times NEW() was called */
byte
*
sf_min_adress
=
(
byte
*
)
~
(
unsigned
long
)
0L
,
byte
*
sf_min_adress
=
(
byte
*
)
~
(
unsigned
long
)
0L
,
*
sf_max_adress
=
(
byte
*
)
0L
;
*
sf_max_adress
=
(
byte
*
)
0L
;
/* Root of the linked list of struct st_irem */
/* Root of the linked list of remembers */
struct
st_irem
*
sf_malloc_root
=
NULL
;
struct
remember
*
pRememberRoot
=
NULL
;
/* from my_alarm */
/* from my_alarm */
int
volatile
my_have_got_alarm
=
0
;
/* declare variable to reset */
int
volatile
my_have_got_alarm
=
0
;
/* declare variable to reset */
...
...
mysys/my_static.h
View file @
ecdb1c76
...
@@ -33,27 +33,23 @@ struct st_remember {
...
@@ -33,27 +33,23 @@ struct st_remember {
};
};
/*
/*
The size of the following structure MUST be dividable by 8 to not cause
Structure that stores information of a allocated memory block
alignment problems on some cpu's
The data is at &struct_adr+sizeof(ALIGN_SIZE(sizeof(struct irem)))
The lspecialvalue is at the previous 4 bytes from this, which may not
necessarily be in the struct if the struct size isn't aligned at a 8 byte
boundary.
*/
*/
struct
irem
struct
st_
irem
{
{
struct
remember
*
_pNext
;
/* Linked list of structures */
struct
st_irem
*
next
;
/* Linked list of structures */
struct
remember
*
_pPrev
;
/* Other link */
struct
st_irem
*
prev
;
/* Other link */
char
*
_sFileName
;
/* File in which memory was new'ed */
char
*
filename
;
/* File in which memory was new'ed */
uint32
_uLineNum
;
/* Line number in above file */
uint32
linenum
;
/* Line number in above file */
uint32
_uDataSize
;
/* Size requested */
uint32
datasize
;
/* Size requested */
#if SIZEOF_CHARP == 8
uint32
SpecialValue
;
/* Underrun marker value */
long
_filler
;
/* For alignment */
#endif
long
_lSpecialValue
;
/* Underrun marker value */
};
};
struct
remember
{
struct
irem
tInt
;
char
aData
[
1
];
};
extern
char
NEAR
curr_dir
[
FN_REFLEN
],
NEAR
home_dir_buff
[
FN_REFLEN
];
extern
char
NEAR
curr_dir
[
FN_REFLEN
],
NEAR
home_dir_buff
[
FN_REFLEN
];
...
@@ -70,8 +66,8 @@ extern int _my_tempnam_used;
...
@@ -70,8 +66,8 @@ extern int _my_tempnam_used;
#endif
#endif
extern
byte
*
sf_min_adress
,
*
sf_max_adress
;
extern
byte
*
sf_min_adress
,
*
sf_max_adress
;
extern
uint
cNewC
ount
;
extern
uint
sf_malloc_c
ount
;
extern
struct
remember
*
pRememberR
oot
;
extern
struct
st_irem
*
sf_malloc_r
oot
;
#if defined(THREAD) && !defined(__WIN__)
#if defined(THREAD) && !defined(__WIN__)
extern
sigset_t
my_signals
;
/* signals blocked by mf_brkhant */
extern
sigset_t
my_signals
;
/* signals blocked by mf_brkhant */
...
...
mysys/safemalloc.c
View file @
ecdb1c76
This diff is collapsed.
Click to expand it.
sql/mysqld.cc
View file @
ecdb1c76
...
@@ -4292,7 +4292,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
...
@@ -4292,7 +4292,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break
;
break
;
case
OPT_SAFEMALLOC_MEM_LIMIT
:
case
OPT_SAFEMALLOC_MEM_LIMIT
:
#if !defined(DBUG_OFF) && defined(SAFEMALLOC)
#if !defined(DBUG_OFF) && defined(SAFEMALLOC)
s
afe
malloc_mem_limit
=
atoi
(
argument
);
s
f_
malloc_mem_limit
=
atoi
(
argument
);
#endif
#endif
break
;
break
;
#ifdef EMBEDDED_LIBRARY
#ifdef EMBEDDED_LIBRARY
...
...
sql/sql_parse.cc
View file @
ecdb1c76
...
@@ -1208,9 +1208,10 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
...
@@ -1208,9 +1208,10 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
opened_tables
,
refresh_version
,
cached_tables
(),
opened_tables
,
refresh_version
,
cached_tables
(),
uptime
?
(
float
)
thd
->
query_id
/
(
float
)
uptime
:
0
);
uptime
?
(
float
)
thd
->
query_id
/
(
float
)
uptime
:
0
);
#ifdef SAFEMALLOC
#ifdef SAFEMALLOC
if
(
lCurM
emory
)
// Using SAFEMALLOC
if
(
sf_malloc_cur_m
emory
)
// Using SAFEMALLOC
sprintf
(
strend
(
buff
),
" Memory in use: %ldK Max memory used: %ldK"
,
sprintf
(
strend
(
buff
),
" Memory in use: %ldK Max memory used: %ldK"
,
(
lCurMemory
+
1023L
)
/
1024L
,(
lMaxMemory
+
1023L
)
/
1024L
);
(
sf_malloc_cur_memory
+
1023L
)
/
1024L
,
(
sf_malloc_max_memory
+
1023L
)
/
1024L
);
#endif
#endif
VOID
(
my_net_write
(
net
,
buff
,(
uint
)
strlen
(
buff
)));
VOID
(
my_net_write
(
net
,
buff
,(
uint
)
strlen
(
buff
)));
VOID
(
net_flush
(
net
));
VOID
(
net_flush
(
net
));
...
...
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