Discussion:
[omniORB] [Q] error testing for memleaks with Visual Studio
V S P
2009-03-31 02:40:58 UTC
Permalink
Hi,
want to test for memory leaks

and I am following the MSD article on the subject
that recommends adding this

#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>


Which I added to the top of my precompiled header file (that I include
everywhere)


This however conflicts with omniOrb, as I get errors all over the place
in stringtypes.h

for example

static inline void free(char* s) {
if (s && s != empty_string) delete[] s;
}

omniorb4/stringtypes.h ( 135, 183, 187 )


I am using latest release (win32/using Visual Studio 2008)

Wanted to ask if there is a workaround for this.

thank you in advance,
Vlad
--
V S P
***@fastmail.fm
--
http://www.fastmail.fm - Access your email from home and the web
Martin Trappel
2009-03-31 14:39:11 UTC
Permalink
Post by V S P
Hi,
want to test for memory leaks
and I am following the MSD article on the subject
that recommends adding this
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
This however conflicts with omniOrb, as I get errors all over the place
in stringtypes.h
for example
static inline void free(char* s) {
if (s && s != empty_string) delete[] s;
}
omniorb4/stringtypes.h ( 135, 183, 187 )
I am using latest release (win32/using Visual Studio 2008)
Wanted to ask if there is a workaround for this.
Does your project include MFC?
I have had problems with MFC leak detection before ...
( maybe check
http://www.omniorb-support.com/pipermail/omniorb-list/2008-July/029583.html
)

br,
Martin
V S P
2009-03-31 22:53:08 UTC
Permalink
hi, do not use MFC
(just boost, specifically boost::asio)

Boost also has several modules such as boost/tls (thread local storage)
and boost/posix time

such that if I include crtdbg infront of them -- I get errors

so what I did for now, is just included the crtdbg and the redefintion
of new
after omniHeaders and the two boost headers (and streambuf standard
header)

now it compiles -- but lots of leaks on boost::shared_ptr (which is what
I use
extensively) so kind of hard to get anything out of it...


thank you for your help.

Vlad
Post by Martin Trappel
Post by V S P
Hi,
want to test for memory leaks
and I am following the MSD article on the subject
that recommends adding this
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
This however conflicts with omniOrb, as I get errors all over the place
in stringtypes.h
for example
static inline void free(char* s) {
if (s && s != empty_string) delete[] s;
}
omniorb4/stringtypes.h ( 135, 183, 187 )
I am using latest release (win32/using Visual Studio 2008)
Wanted to ask if there is a workaround for this.
Does your project include MFC?
I have had problems with MFC leak detection before ...
( maybe check
http://www.omniorb-support.com/pipermail/omniorb-list/2008-July/029583.html
)
br,
Martin
--
V S P
***@fastmail.fm
--
http://www.fastmail.fm - The professional email service
Loading...