Fix memory tracking

svn path=/trunk/; revision=20505
This commit is contained in:
Gé van Geldorp 2006-01-01 11:48:11 +00:00
parent de1cfe67f5
commit 736ed18513
6 changed files with 12 additions and 11 deletions

View file

@ -329,8 +329,8 @@ extern struct kmembuckets bucket[];
extern void *malloc __P((unsigned long size, ...));
extern void free __P((void *addr, ...));
#else
#define malloc fbsd_malloc
#define free fbsd_free
#define malloc(size, flags, id) fbsd_malloc(size, __FILE__, __LINE__)
#define free(area, flags) fbsd_free(area, __FILE__, __LINE__)
#endif
#endif /* KERNEL */
#endif /* !_SYS_MALLOC_H_ */

View file

@ -304,7 +304,7 @@ union mcluster {
#ifdef __REACTOS__
#define MCLGET(m, how) { \
OS_DbgPrint(OSK_MID_TRACE,("(MCLGET) m = %x\n", m)); \
(m)->m_ext.ext_buf = malloc(MCLBYTES); \
(m)->m_ext.ext_buf = malloc(MCLBYTES,__FILE__,__LINE__); \
if ((m)->m_ext.ext_buf != NULL) { \
(m)->m_data = (m)->m_ext.ext_buf; \
(m)->m_flags |= M_EXT; \
@ -313,7 +313,7 @@ union mcluster {
}
#define MCLFREE(p) { \
free( (p) ); \
free( (p), 0 ); \
}
#else
#define MCLGET(m, how) \

View file

@ -30,6 +30,6 @@ static __inline void panic ( const char* fmt, ... )
#define panic(...) do { printf(__VA_ARGS__); \
oskittcp_die(__FILE__,__LINE__); } while(0)
#endif//_MSC_VER
#define kmem_malloc(x,y,z) malloc(y)
#define kmem_malloc(x,y,z) malloc(y,0,0)
#endif//_OSKITFREEBSD_H

View file

@ -155,8 +155,8 @@ void OskitTCPGetAddress( void *socket,
#undef errno
void *fbsd_malloc( unsigned int bytes, ... );
void fbsd_free( void *data, ... );
void *fbsd_malloc( unsigned int bytes, char *file, unsigned line, ... );
void fbsd_free( void *data, char *file, unsigned line, ... );
#if 0
#define malloc(x) fbsd_malloc(x,__FILE__,__LINE__)
#define free(x) fbsd_free(x,__FILE__,__LINE__)

View file

@ -5,6 +5,7 @@
<define name="_DISABLE_TIDENTS"/>
<define name="__USE_W32API"/>
<define name="__NO_CTYPE_INLINES" />
<define name="MEMTRACK" />
<include>drivers/lib/oskittcp/include/freebsd</include>
<include>drivers/lib/oskittcp/include/freebsd/sys/include</include>
<include>drivers/lib/oskittcp/include/freebsd/src/sys</include>

View file

@ -33,15 +33,15 @@ void clock_init();
int isprint(int c);
int _snprintf(char * buf, size_t cnt, const char *fmt, ...);
void *fbsd_malloc( unsigned int bytes, ... ) {
void *fbsd_malloc( unsigned int bytes, char *file, unsigned line, ... ) {
if( !OtcpEvent.TCPMalloc ) panic("no malloc");
return OtcpEvent.TCPMalloc
( OtcpEvent.ClientData, (OSK_UINT)bytes, "*", 0 );
( OtcpEvent.ClientData, (OSK_UINT)bytes, file, line );
}
void fbsd_free( void *data, ... ) {
void fbsd_free( void *data, char *file, unsigned line, ... ) {
if( !OtcpEvent.TCPFree ) panic("no free");
OtcpEvent.TCPFree( OtcpEvent.ClientData, data, "*", 0 );
OtcpEvent.TCPFree( OtcpEvent.ClientData, data, file, line );
}
void InitOskitTCP() {