TheSwamp

Code Red => ARX Programming => Topic started by: Andrey Bushman on July 05, 2013, 03:33:51 AM

Title: About the memory leak for the ObjectARX samples
Post by: Andrey Bushman on July 05, 2013, 03:33:51 AM
Quote from: ObjectARX for AutoCAD 2013: Readme -> Tips and Techniques -> Freeing Strings Returned as Non-const Pointers
...
Note that some of the ObjectARX sample files are missing calls to free the memory, so they will exhibit memory leaks. When using the samples in your own code, make sure to free the memory properly.
I learning the C++ and parallely I learning the ObjectARX. I am sure - such beginners are many exist. The inexperienced beginner (such as me)  can does not find errors with memory leak, therefore official documentation shan't contain examples with such errors. It shall be the sample for imitating, as I think.
Title: Re: About the memory leak for the ObjectARX samples
Post by: dgorsman on July 05, 2013, 10:09:19 AM
I think its assumed both that those who are learning have the basics of C++ mechanics, as well as being focused on instructing the AutoCAD side rather than the C++ side.  Would be nice if all samples were technically correct, but if you have 10% of the code as whats demonstrated and 90% clean-up for technical correctness its easy to miss the point.
Title: Re: About the memory leak for the ObjectARX samples
Post by: Keith™ on July 05, 2013, 03:04:02 PM
Even for the experienced, memory leaks can and do happen regularly.

Just ask yourself how many times you have read "Bug Fix: Fixed memory leak" in the upgrade documentation.

I have to chose from this list to explain why that happens continuously:

1) The programmer is a novice
2) The programmer doesn't care
3) The company doesn't care
4) All of the above


There may be other reasons, but this seems to cover all the bases.