Re: Leaking objects... [message #29930 is a reply to message #29928] |
Wed, 27 March 2002 08:29  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Randall Skelton (rhskelto@atm.ox.ac.uk) writes:
> I gave some IDL object code to someone who has no idea what object
> programming is. Despite giving her a quick lesson on object life-cycles,
> she did the inevitable and directly overwrote an object, creating dangling
> pointers.
>
> My question is, how do I prevent this from happening in my code? This
> behavior seems a little fragile to me. Ideally, I would like obj_new to
> either block the creation of a new object or cleanup pre-existing objects.
> What I don't want to do is try and educate the user again... sorry mom.
You may *think* you want Obj_New to block the creation
of a new object, but I can assure you, you *don't*. :-)
Having only one of any particular kind of object would
be just a tad limiting, don't you think?
IDL is an inherently dangerous language. You really don't
have any choice but to make an attempt to educate the
people who use it. If we didn't believe this, why else
would we all be hanging out here on the newsgroup?
Cheers,
David
P.S. You might suggest to your user that she become
more familiar with HEAP_GC. That might help. :-)
--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|