Enabling CodeGaurd for you RAD Studio C++ application for memory leak detection

Just a quick note on how to enable CodeGaurd memory leak detection under Embarcadero C++ Builder.

  • The CodeGaurd setup is under Tools->CodeGuard

Under Project->Options :-

  • Under C++ Compiler->Debugging turn "Enable Codegaurd" on
  • Under C++ Linker turn off "Link with Dynamic RTL" and check "Full debug information" is turned on
  • Under Packages->Runtime Packages turn off "Link with runtime packages"

Now on exiting the application you should be shown the call stack and any resource leaks can be stepped through and are shown in the Messages window under the CodeGaurd tab.

You will also get an .cgl file generated in your application directory that will contain the same CodeGaurd information.

Deleaker to the rescue!

Since the introduction of C++ Clang compiling there is no CodeGaurd variant available for Rad Studio in any version. So if you want to check for code leaks your hands are tied.

This is where a Third party application called Deleaker comes into play and is by far superior to CodeGaurd and along with C++ will also be compatible with C#, .NET and Delphi.

Not only that you get 32bit and 64 bit testing with nice optional integration into the IDE itself.

You not get only get memory leak detection but GDI and handle leak detection as well with the option of running a standalone application that will give your real-time display of leaks along with snapshot functionality.

All in all a super handy tool for C++ leak detection is now available with the modern Clang compliant compilers.

Filed under: Embarcadero  Tags: Radstudio, Cpp

0 Responses to “Enabling CodeGaurd for you RAD Studio C++ application for memory leak detection”

Sorry, comments have been closed for this post.
(default) 12 queries took 1 ms
NrQueryErrorAffectedNum. rowsTook (ms)
1DESCRIBE `posts`17171
2DESCRIBE `comments`11110
3DESCRIBE `tags`220
4DESCRIBE `categories`220
5DESCRIBE `posts_tags`220
6DESCRIBE `categories_posts`220
7SELECT `Post`.`id`, `Post`.`url`, `Post`.`title`, `Post`.`icon`, `Post`.`metadesc`, `Post`.`metakeys`, `Post`.`categories`, `Post`.`tease`, `Post`.`body`, `Post`.`private_body`, `Post`.`created`, `Post`.`modified`, `Post`.`status`, `Post`.`allow_comments`, `Post`.`tags`, `Post`.`hitcount`, `Post`.`hitcount_rss` FROM `posts` AS `Post` WHERE `Post`.`url` = 'enabling-codegaurd-for-you-rad-studio-c-application-for-memory-leak-detection' LIMIT 1110
8SELECT `Comment`.`id`, `Comment`.`post_id`, `Comment`.`body`, `Comment`.`author`, `Comment`.`url`, `Comment`.`email`, `Comment`.`ip`, `Comment`.`status`, `Comment`.`junk_score`, `Comment`.`created`, `Comment`.`modified` FROM `comments` AS `Comment` WHERE `Comment`.`status` = 2 AND `Comment`.`post_id` = (104) 000
9SELECT `Tag`.`id`, `Tag`.`tag`, `PostsTag`.`post_id`, `PostsTag`.`tag_id` FROM `tags` AS `Tag` JOIN `posts_tags` AS `PostsTag` ON (`PostsTag`.`post_id` = 104 AND `PostsTag`.`tag_id` = `Tag`.`id`) 220
10SELECT `Category`.`id`, `Category`.`category`, `CategoriesPost`.`post_id`, `CategoriesPost`.`category_id` FROM `categories` AS `Category` JOIN `categories_posts` AS `CategoriesPost` ON (`CategoriesPost`.`post_id` = 104 AND `CategoriesPost`.`category_id` = `Category`.`id`) 110
11UPDATE `posts` AS `Post` SET `Post`.`hitcount_rss` = Post.hitcount_rss + 1 WHERE `Post`.`id` = 10410
12UPDATE `posts` AS `Post` SET `Post`.`hitcount` = Post.hitcount + 1 WHERE `Post`.`id` = 10410