Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > pointers manager ?

Reply
Thread Tools

pointers manager ?

 
 
James Kanze
Guest
Posts: n/a
 
      04-20-2007
On Apr 20, 6:07 pm, "Victor Bazarov" <(E-Mail Removed)> wrote:
> Marcelo Fernandez wrote:
> > I was wondering if there is tool that could tell me if some of my
> > pointers are still alive when they are suppose to be dead (in case I
> > forget to kill them...).


> > As you have noticed, I am real newbie in c++ programming and I have
> > quite a trouble to remember which pointer should be alive and which
> > one should die (Java garbage collector fault...).


> There are two approaches: either learn to manage their lifetime
> or use a garbage collector. There are rules for managing lifetime
> of dynamic objects, and I bet books talk about them (like ownership,
> reference counting...), you just need to find the right book. As
> for garbage collector, there are several implementations on the
> market, just look for them.


> There are no tools that can tell when the pointer "are suppose to be
> dead". There are tools that can identify memory that has never been
> deallocated after the program has finished running. Those are called
> "memory leak detector". Look them up.


Most such tools can also find dangling pointers---pointers to
memory that you have already freed. The two that I'm familiar
with are Purify (excellent, but definitly not priced for student
use), and valgrind (worked well the only time I used it, but
I've not enough experience with it to say more).

--
James Kanze (Gabi Software) email: http://www.velocityreviews.com/forums/(E-Mail Removed)
Conseils en informatique orient閑 objet/
Beratung in objektorientierter Datenverarbeitung
9 place S閙ard, 78210 St.-Cyr-l'蒫ole, France, +33 (0)1 30 23 00 34

 
Reply With Quote
 
 
 
 
Roland Pibinger
Guest
Posts: n/a
 
      04-21-2007
On Fri, 20 Apr 2007 14:11:10 -0700, Marcelo Fernandez wrote:
>I will check for those tools, but I think I should really practice my
>c++ programming. Thanks a lot!


See also: Tom Cargill: Managing Dynamic Objects in C++
http://www.ddj.com/184409895


--
Roland Pibinger
"C++ is my favorite garbage collected language because
it produces so little garbage." - Bjarne Stroustrup
 
Reply With Quote
 
 
 
 
SimpleCode
Guest
Posts: n/a
 
      04-21-2007
On 4月20日, 下午11时54分, Marcelo Fernandez <(E-Mail Removed)> wrote:
> Hi !
>
> I was wondering if there is tool that could tell me if some of my
> pointers are still alive when they are suppose to be dead (in case I
> forget to kill them...).
>
> As you have noticed, I am real newbie in c++ programming and I have
> quite a trouble to remember which pointer should be alive and which one
> should die (Java garbage collector fault...).
>
> Thanks a lot !!
>
> Marcelo


You can use a excellent class called AutoFreeAlloc which is from WinX.
It has a perfect new and delete doing.
Also, It will autofree the memory you don't delete.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
pointers, pointers, pointers... cerr C Programming 12 04-07-2011 11:17 PM
Help!!How to upgrade campus manager 3.1 in ciscoworks 2000 LMS to campus manager 3.3? zll9527 Cisco 1 02-26-2004 01:14 AM



Advertisments