home  
homepage tools
computer art gallery desktop backgrounds
movies 3d action webgame
mobile pictures free mp3 ringtones

No installation. USB stick portable applications.

Depeche View

light speed
full text search.

Swiss File Knife

a command line
multi function tool.

remove tabs
list dir sizes
find text
filter lines
find in path
collect text
instant ftp or
http server
file transfer
patch text
patch binary
run own cmd
convert crlf
dup file find
md5 lists
fromto clip
hexdump
split files
list latest
compare dirs
save typing
trace http
echo colors
head & tail
find classes
dep. listing
speed shell
zip search
zip dir list
 
top 100 search

firefox add-ons

using vm linux

windows GUI
automation

the d3caster
java game engine

free external tools,
zero install effort,
usb stick compliant:

zip and unzip
diff and merge
reformat xml
reformat source
virtual desktops
notepad++

java sources

thread creation

cpp sources

log tracing
mem tracing
hexdump
using printf

articles

source analysis
zip code search
1680 desktops
1920 desktops
3D gallery

 
Bookmark on del.icio.us Bookmark on Google Add to Mr. Wong
Bookmark on digg.com Add to StumbleUpon Bookmark on Yahoo


computer art gallery
Pink Orchids
 

How to trace memory leaks C++ with a few lines of code:
free source code for instant use in windows projects.

starting point: let's say we have a simple C++ program like this:

#include <stdio.h>
#include <string.h>

char *joinStrings(char *p1, char *p2)
{
   int nlen1 = strlen(p1);
   int nlen2 = strlen(p2);
   char *pres = new char[nlen1+nlen2+10];
   strcpy(pres, p1);
   strcat(pres, p2);
   return pres;
}

int main(int argc, char *argv[])
{
   printf("string concatenation test:\n");
   char *psz1 = "hello";
   char *psz2 = "world";
   char *pszj = joinStrings(psz1, psz2);
   printf("result: %s\n", pszj);
   return 0;
}
this program seems to run without problems, producing this output:
   string concatenation test:
   result: helloworld
however we don't really know if all memory has been freed.
 

to find out, download memdeb.cpp from here and extend the example like this:

#include <stdio.h>
#include <string.h>

#include "memdeb.cpp"

char *joinStrings(char *p1, char *p2)
{
   int nlen1 = strlen(p1);
   int nlen2 = strlen(p2);
   char *pres = new char[nlen1+nlen2+10];
   strcpy(pres, p1);
   strcat(pres, p2);
   return pres;
}

int main(int argc, char *argv[])
{
   printf("string concatenation test:\n");
   char *psz1 = "hello";
   char *psz2 = "world";
   char *pszj = joinStrings(psz1, psz2);
   printf("result: %s\n", pszj);

   listMemoryLeaks();

   return 0;
}
now, the program produces this output:
string concatenation test:
result: helloworld
MEM LEAK: adr 32075ch, size 20, alloc'ed in test.cpp 10
[SMEMDEBUG: 1 new's, 0 delete's, 0 errors, 1 leaks]
if you want to integrate the memory tracing into a project with several .cpp files, include it everywhere, defining in most files
#define MEMDEB_JUST_DECLARE
before the include. only in one .cpp file, leave out this define. it should also be easy to split memdeb.cpp into a .hpp and .cpp, as the code is rather short.

NOTE:

  • as all free stuff, SFK memory tracing comes without any warranty
  • it eats some performance when used with many memory objects
  • it is not thread safe
and if you integrate this into a project, always do it in a way which allows (de)activation through a define, e.g.
   #ifdef WITH_MEMORY_TRACING
     #include "memdeb.cpp"
   #endif

SFK memory tracing is used to track memory leaks in the text file processor swiss file knife. read more about sfk here.

Download the free Depeche View Base Text Search Tool

home| gallery| desktops| games| mobile pics| ringtones| movies| stahlmedia| tools
 

 
 
 
Moments
In Space
 
 
The Movie
 
 
 
 
 
 

 
 
StahlWorks Art and Technology Surreal Computer Artworks Desktop Backgrounds CGI Movies 3D Action Browser Game Mobile Phone Wallpapers Mobile Phone Ringtones Free Windows and Linux Tools