Commit 9e5ec9a5 authored by monty@narttu.mysql.fi's avatar monty@narttu.mysql.fi

Merge bk-internal.mysql.com:/home/bk/mysql-4.0

into narttu.mysql.fi:/my/mysql-4.0
parents 977c66b4 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 safemalloc_mem_limit;
extern ulonglong sf_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,
......
......@@ -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"
......
......@@ -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 */
......
......@@ -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 cNewCount;
extern struct remember *pRememberRoot;
extern uint sf_malloc_count;
extern struct st_irem *sf_malloc_root;
#if defined(THREAD) && !defined(__WIN__)
extern sigset_t my_signals; /* signals blocked by mf_brkhant */
......
This diff is collapsed.
......@@ -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)
safemalloc_mem_limit = atoi(argument);
sf_malloc_mem_limit = atoi(argument);
#endif
break;
#ifdef EMBEDDED_LIBRARY
......
......@@ -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 (lCurMemory) // Using SAFEMALLOC
if (sf_malloc_cur_memory) // 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));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment