CPPFLAGS="$CPPFLAGS "'-I$(top_srcdir)'
CPPFLAGS="$CPPFLAGS -D_REENTRANT $PYTHON_CPPFLAGS $MD5SUM_CFLAGS $FREETYPE_CFLAGS $FRIBIDI_CFLAGS $ID3TAG_CFLAGS $MAD_CFLAGS $PLUGINS_CFLAGS $PNG_CFLAGS $SDL_CFLAGS $SIGC_CFLAGS $XMLTREE_CFLAGS $DVBSI_CFLAGS $GSTREAMER_CFLAGS $LIBUNGIF_CLFAGS"
+#CPPFLAGS="$CPPFLAGS -DMEMLEAK_CHECK"
CXXFLAGS="$CXXFLAGS -fno-rtti -fno-exceptions -Wall"
LDFLAGS="$LDFLAGS -pthread $PYTHON_LDFLAGS $SDL_LDFLAGS $GSTREAMER_LDFLAGS $LIBUNGIF_LDFLAGS"
+#LDFLAGS="-rdynamic $LDFLAGS"
TUXBOX_APPS_GETTEXT
if(!allocList)
return;
+ FILE *f = fopen("/var/tmp/enigma2_mem.out", "w");
size_t len = 1024;
char *buffer = (char*)malloc(1024);
for(i = allocList->begin(); i != allocList->end(); i++)
{
unsigned int tmp;
- printf("%s\tLINE %d\tADDRESS %p\t%d unfreed\ttype %d (btcount %d)\n",
+ fprintf(f, "%s\tLINE %d\tADDRESS %p\t%d unfreed\ttype %d (btcount %d)\n",
i->second.file, i->second.line, (void*)i->second.address, i->second.size, i->second.type, i->second.btcount);
totalSize += i->second.size;
+
char **bt_string = backtrace_symbols( i->second.backtrace, i->second.btcount );
for ( tmp=0; tmp < i->second.btcount; tmp++ )
{
int state;
abi::__cxa_demangle(tmp1.c_str(), buffer, &len, &state);
if (!state)
- printf("%d %s%s\n", tmp, buffer,tmp2.c_str());
+ fprintf(f, "%d %s%s\n", tmp, buffer,tmp2.c_str());
else
- printf("%d %s\n", tmp, bt_string[tmp]);
+ fprintf(f, "%d %s\n", tmp, bt_string[tmp]);
}
}
}
else
- printf("%d %s\n", tmp, bt_string[tmp]);
+ fprintf(f, "%d %s\n", tmp, bt_string[tmp]);
}
}
free(bt_string);
- printf("\n");
+ if (i->second.btcount)
+ fprintf(f, "\n");
}
free(buffer);
- printf("-----------------------------------------------------------\n");
- printf("Total Unfreed: %d bytes\n", totalSize);
- fflush(stdout);
+ fprintf(f, "-----------------------------------------------------------\n");
+ fprintf(f, "Total Unfreed: %d bytes\n", totalSize);
+ fflush(f);
};
#endif
{
unsigned int address;
unsigned int size;
- char *file;
+ const char *file;
void *backtrace[BACKTRACE_DEPTH];
unsigned char btcount;
unsigned short line;
allocList = new(AllocList);
info.address = addr;
- info.file = strdup(fname);
+ info.file = fname;
info.line = lnum;
info.size = asize;
info.type = type;
- info.btcount = backtrace( info.backtrace, BACKTRACE_DEPTH );
+ info.btcount = 0; //backtrace( info.backtrace, BACKTRACE_DEPTH );
singleLock s(memLock);
(*allocList)[addr]=info;
};
if ( i->second.type != type )
i->second.type=3;
else
- {
- free(i->second.file);
allocList->erase(i);
- }
}
};
-inline void * operator new(unsigned int size, const char *file, int line)
+inline void * operator new(size_t size, const char *file, int line)
{
void *ptr = (void *)malloc(size);
AddTrack((unsigned int)ptr, size, file, line, 1);
free(p);
};
-inline void * operator new[](unsigned int size, const char *file, int line)
+inline void * operator new[](size_t size, const char *file, int line)
{
void *ptr = (void *)malloc(size);
AddTrack((unsigned int)ptr, size, file, line, 2);