Author Topic: About the memory leak for the ObjectARX samples  (Read 3259 times)

0 Members and 1 Guest are viewing this topic.

Andrey Bushman

  • Swamp Rat
  • Posts: 860
About the memory leak for the ObjectARX samples
« 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.

dgorsman

  • Water Moccasin
  • Posts: 2434
Re: About the memory leak for the ObjectARX samples
« Reply #1 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.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16867
  • Superior Stupidity at its best
Re: About the memory leak for the ObjectARX samples
« Reply #2 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.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie