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 */
#define QUICK_SAFEMALLOC sf_malloc_quick=1
#define NORMAL_SAFEMALLOC sf_malloc_quick=0
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 , __FILE__, __LINE__
...
...
@@ -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_dont_interrupt
;
/* call remember_intr when set */
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
my_bool
NEAR
my_disable_locking
,
NEAR
my_disable_async_io
,
...
...
mysys/default.c
View file @
ecdb1c76
...
...
@@ -33,8 +33,6 @@
** --print-defaults ; Print the modified command line and exit
****************************************************************************/
#undef SAFEMALLOC
/* safe_malloc is not yet initailized */
#include "mysys_priv.h"
#include "m_string.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- */
sf_malloc_endhunc
=
0
,
/* dump when malloc-message.... */
/* set theese to 64 or 128 */
sf_malloc_quick
=
0
;
/* set if no calls to sanity */
long
lCurMemory
=
0L
;
/* Current memory usage */
long
lMaxMemory
=
0L
;
/* Maximum memory usage */
uint
cNewCount
=
0
;
/* Number of times NEW() was called */
ulong
sf_malloc_cur_memory
=
0L
;
/* Current memory usage */
ulong
sf_malloc_max_memory
=
0L
;
/* Maximum memory usage */
uint
sf_malloc_count
=
0
;
/* Number of times NEW() was called */
byte
*
sf_min_adress
=
(
byte
*
)
~
(
unsigned
long
)
0L
,
*
sf_max_adress
=
(
byte
*
)
0L
;
/* Root of the linked list of remembers */
struct
remember
*
pRememberRoot
=
NULL
;
/* Root of the linked list of struct st_irem */
struct
st_irem
*
sf_malloc_root
=
NULL
;
/* from my_alarm */
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 {
};
/*
The size of the following structure MUST be dividable by 8 to not cause
alignment problems on some cpu's
Structure that stores information of a allocated memory block
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
remember
*
_pPrev
;
/* Other link */
char
*
_sFileName
;
/* File in which memory was new'ed */
uint32
_uLineNum
;
/* Line number in above file */
uint32
_uDataSize
;
/* Size requested */
#if SIZEOF_CHARP == 8
long
_filler
;
/* For alignment */
#endif
long
_lSpecialValue
;
/* Underrun marker value */
struct
st_irem
*
next
;
/* Linked list of structures */
struct
st_irem
*
prev
;
/* Other link */
char
*
filename
;
/* File in which memory was new'ed */
uint32
linenum
;
/* Line number in above file */
uint32
datasize
;
/* Size requested */
uint32
SpecialValue
;
/* Underrun marker value */
};
struct
remember
{
struct
irem
tInt
;
char
aData
[
1
];
};
extern
char
NEAR
curr_dir
[
FN_REFLEN
],
NEAR
home_dir_buff
[
FN_REFLEN
];
...
...
@@ -70,8 +66,8 @@ extern int _my_tempnam_used;
#endif
extern
byte
*
sf_min_adress
,
*
sf_max_adress
;
extern
uint
cNewC
ount
;
extern
struct
remember
*
pRememberR
oot
;
extern
uint
sf_malloc_c
ount
;
extern
struct
st_irem
*
sf_malloc_r
oot
;
#if defined(THREAD) && !defined(__WIN__)
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)),
break
;
case
OPT_SAFEMALLOC_MEM_LIMIT
:
#if !defined(DBUG_OFF) && defined(SAFEMALLOC)
s
afe
malloc_mem_limit
=
atoi
(
argument
);
s
f_
malloc_mem_limit
=
atoi
(
argument
);
#endif
break
;
#ifdef EMBEDDED_LIBRARY
...
...
sql/sql_parse.cc
View file @
ecdb1c76
...
...
@@ -1208,9 +1208,10 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
opened_tables
,
refresh_version
,
cached_tables
(),
uptime
?
(
float
)
thd
->
query_id
/
(
float
)
uptime
:
0
);
#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"
,
(
lCurMemory
+
1023L
)
/
1024L
,(
lMaxMemory
+
1023L
)
/
1024L
);
(
sf_malloc_cur_memory
+
1023L
)
/
1024L
,
(
sf_malloc_max_memory
+
1023L
)
/
1024L
);
#endif
VOID
(
my_net_write
(
net
,
buff
,(
uint
)
strlen
(
buff
)));
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