[ace-users] FW: checking application for memory leaks

Douglas C. Schmidt schmidt at dre.vanderbilt.edu
Wed Sep 19 00:05:41 CDT 2007


Hi Kim,

   I don't use Windows, so we'll have to wait for someone with Windows
experience to shed some light on this.  In general, we track memory
issues on Windows using Purify, so you might try going that route.

thanks,

        Doug

> But is'nt it the idea that the memory allocation rutines will be
> overloaded to be able to track the leak?
> And if you include them after ACE includes, this won't happen somehow?
> I used this code.
> 
> 
> 
> //**********************************************************
> // function:
> //
> //  create a DataFactory => creates a Connection, 
> //      AcceptFactory and DisconFactory object,
> //      handling incomming socket data.
> //
> //  create a ConsoleFactory to handle user input.
> // 
> //  create a ConsoleHandler to handle console events.
> //
> //  create a TimerHandler => creates a Connection object,
> //      create a TimConFactory object to handle timer events, 
> //      and connect to local host at first timeout, reload the
> //      timer, and send "quit" txt resulting in exiting the 
> //      application.
> //
> //**********************************************************
> int main(int argc, ACE_TCHAR *argv[])
> {
>     // handle socket input.
>     DataFactory tst( &EventManager::instance() ) ;
> 
>     // handle console input.
>     ConsoleFactory *cf = new ConsoleFactory() ;
>     ConsoleHandler *ch = new ConsoleHandler( &EventManager::instance(),
> cf ) ;
> 
>     // launch a timer to create a connection to local host.
>     TimerHandler th( &EventManager::instance(), new TimConFactory(), 5 )
> ;
> 
>     std::cout << "Entering event loop!" << std::endl ;
>     while( finished == false )
>     {
>         EventManager::instance().handleEvents() ;
>     }
> 
>     //delete ch ;
>     //delete cf ;
> 
> 	return 0;
> }
> 
> > -----Original Message-----
> > From: schmidt at dre.vanderbilt.edu [mailto:schmidt at dre.vanderbilt.edu]
> > Sent: 19. september 2007 06:48
> > To: Kim J. Schmock; ace-users at cse.wustl.edu
> > Subject: Re: [ace-users] checking application for memory leaks
> > 
> > 
> > Hi Kim,
> > 
> > Thanks very much for your email.  Please make sure to send all
> > questions related to TAO or ACE to the ACE mailing list or ACE+TAO
> > newsgroup, rather than to me directly since I travel frequently and
> > often don't have ready access to email.
> > 
> > > Build errors:
> > >
> > > Error	1	error C2059: syntax error : 'constant'
> c:\program
> > > files\ace_wrappers-5.5\ace\os_ns_stdlib.h	103
> > > Error	2	error C2059: syntax error : 'constant'
> c:\program
> > > files\ace_wrappers-5.5\ace\os_ns_stdlib.h	109
> > > Error	3	error C2059: syntax error : 'constant'
> c:\program
> > > files\ace_wrappers-5.5\ace\os_ns_stdlib.h	147
> > > Error	4	error C2059: syntax error : 'constant'
> c:\program
> > > files\ace_wrappers-5.5\ace\os_ns_stdlib.h	200
> > > Error	5	error C2059: syntax error : 'constant'
> c:\program
> > > files\ace_wrappers-5.5\ace\malloc_base.h	65
> > > Error	6	error C2059: syntax error : 'constant'
> c:\program
> > > files\ace_wrappers-5.5\ace\malloc_base.h	68
> > > Warning	7	warning C4002: too many actual parameters for
> macro
> > > 'calloc'	c:\program files\ace_wrappers-5.5\ace\malloc_base.h
> > > 74
> > > Error	8	error C2059: syntax error : 'constant'
> c:\program
> > > files\ace_wrappers-5.5\ace\malloc_base.h	74
> > > Error	9	error C2059: syntax error : 'constant'
> c:\program
> > > files\ace_wrappers-5.5\ace\malloc_base.h	77
> > > Error	10	error C2059: syntax error : 'constant'
> c:\program
> > > files\ace_wrappers-5.5\ace\os_ns_unistd.h	148
> > > Error	11	error C2059: syntax error : 'constant'
> c:\program
> > > files\ace_wrappers-5.5\ace\os_ns_unistd.h	152
> > > Error	12	error C2059: syntax error : 'constant'
> c:\program
> > > files\ace_wrappers-5.5\ace\os_ns_string.h	154
> > > Error	13	error C2059: syntax error : 'constant'
> c:\program
> > > files\ace_wrappers-5.5\ace\os_ns_string.h	165
> > 
> > Make sure that you always include the ACE header files before any
> other
> > header files.
> > 
> > Thanks,
> > 
> >         Doug
> > 
> > >
> > > > -----Original Message-----
> > > > From: schmidt at dre.vanderbilt.edu
> [mailto:schmidt at dre.vanderbilt.edu]
> > > > Sent: 19. september 2007 02:59
> > > > To: Kim J. Schmock
> > > > Cc: ace-users at cs.wustl.edu
> > > > Subject: Re: [ace-users] checking application for memory leaks
> > > >
> > > >
> > > > Hi Kim,
> > > >
> > > > Thanks for using the PRF!
> > > >
> > > > >     ACE VERSION: 5.5.7
> > > >
> > > > Please upgrade to ACE+TAO+CIAO x.6 (i.e., ACE 5.6, TAO 1.6, and
> CIAO
> > > > 0.6), which you can download from
> > > >
> > > > http://download.dre.vanderbilt.edu
> > > >
> > > > under the heading: "Latest Release."
> > > >
> > > > The DOC groups at Washington University, UC Irvine, and Vanderbilt
> > > > University only provide "best effort" support for non-sponsors for
> the
> > > > latest release, as described in
> > > >
> > > > http://www.dre.vanderbilt.edu/~schmidt/DOC_ROOT/ACE/docs/ACE-bug-
> > > > process.html
> > > >
> > > > Thus, if you need more "predictable" help for earlier versions of
> > > > ACE+TAO, I recommend that you check out
> > > >
> > > > http://www.dre.vanderbilt.edu/support.html
> > > >
> > > > for a list of companies that will provide you with ACE+TAO
> commercial
> > > > support.
> > > >
> > > > >     HOST MACHINE and OPERATING SYSTEM:
> > > > >
> > > > > i386 WinXP
> > > > >
> > > > >     COMPILER NAME AND VERSION (AND PATCHLEVEL):
> > > > >
> > > > >             VS8
> > > > >
> > > > >     THE $ACE_ROOT/ace/config.h FILE [if you use a link to a
> > > platform-
> > > > >
> > > > >     specific file, simply state which one]:
> > > > >
> > > > >     THE $ACE_ROOT/include/makeinclude/platform_macros.GNU FILE
> [if
> > > you
> > > > >
> > > > >     use a link to a platform-specific file, simply state which
> one
> > > > >
> > > > >     (unless this isn't used in this case, e.g., with Microsoft
> > > Visual
> > > > >
> > > > >     C++)]:
> > > > >
> > > > >     CONTENTS OF
> > > $ACE_ROOT/bin/MakeProjectCreator/config/default.features
> > > > >
> > > > >     (used by MPC when you generate your own makefiles):
> > > > >
> > > > >     AREA/CLASS/EXAMPLE AFFECTED:
> > > > >
> > > > >     DOES THE PROBLEM AFFECT:
> > > > >
> > > > >         COMPILATION?
> > > > >
> > > > > Yes
> > > > >
> > > > >         LINKING?
> > > > >
> > > > >             On Unix systems, did you run make realclean first?
> > > > >
> > > > >         EXECUTION?
> > > > >
> > > > >         OTHER (please specify)?
> > > > >
> > > > > [Please indicate whether ACE, your application, or both are
> > > affected.]
> > > > >
> > > > >     SYNOPSIS:
> > > > >
> > > > >             Build is failing
> > > > >
> > > > >     DESCRIPTION:
> > > > >
> > > > >             When checking for memoryleaks on Win you include:
> > > > >
> > > > > #define _CRTDBG_MAP_ALLOC
> > > > >
> > > > > #include <stdlib.h>
> > > > >
> > > > > #include <crtdbg.h>
> > > > >
> > > > >             In your main file
> > > > >
> > > > >             Trying to define and include these, make the build
> fail.
> > > > >
> > > > >             How can I check for memoryleaks using ACE?
> > > >
> > > > It's not clear what problems you're having.  Can you please
> provide
> > > the
> > > > output you're seeing?
> > > >
> > > > Thanks,
> > > >
> > > >         Doug
> 
> _______________________________________________
> ace-users mailing list
> ace-users at mail.cse.wustl.edu
> http://mail.cse.wustl.edu/mailman/listinfo/ace-users



More information about the Ace-users mailing list