Author Topic: Fenton Webb's advice re "To dispose or not to dispose"  (Read 74703 times)

0 Members and 1 Guest are viewing this topic.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Fenton Webb's advice re "To dispose or not to dispose"
« Reply #120 on: August 14, 2012, 08:53:39 PM »
I don't disagree on the need for formally documentating basic information, dgorsman. I've already made the author of the .NET developers guide aware of this thread. He's going to look into beefing up the info on transactions, and also fixing the places in the sample code where he's 'new'ing DBObjects without a Using statement. He's currently compiling a task list for updating the developers guide, so now is a good time to respond to my invitation to put forward suggestions. Items already on the list are blocks and plotting.


kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

owenwengerd

  • Bull Frog
  • Posts: 451
Re: Fenton Webb's advice re "To dispose or not to dispose"
« Reply #121 on: August 14, 2012, 09:00:25 PM »
So, if a custom curve class encapsulates an AcGeCurve3d, the above functions should help.

Even given what I can deduce from this information and from the header file comments where the functions are declared, I still can't reliably determine whether the caller or callee is responsible for allocating the new AcGeCurve3d object. There is just no safe way to reliably implement the functions, so I just return Acad::eNotImplemented in my implementation. Which almost certainly means the global functions you mentioned will not work with my custom objects, and may or may not work with other third party custom objects derived from AcDbCurve.

BlackBox

  • King Gator
  • Posts: 3770
Re: Fenton Webb's advice re "To dispose or not to dispose"
« Reply #122 on: August 15, 2012, 12:09:11 AM »
My previous comments were about the AutoCAD API documentation, but I'm happy to pass on your requests/suggestions for other Autodesk products too.

Yes, that would be greatly appreciated. Verticals are lacking even more so than AutoCAD, IMO.

Cheers! :beer:
"How we think determines what we do, and what we do determines what we get."

BlackBox

  • King Gator
  • Posts: 3770
Re: Fenton Webb's advice re "To dispose or not to dispose"
« Reply #123 on: August 15, 2012, 03:09:24 AM »
I've just been informed that the Civil 3D 2013 documentation has received significant improvement over prior years, while I am currently relegated to using Civil 3D and AutoCAD MEP 2011 for production... So FWIW, I appreciate your willingness to convey our suggestions/requests onto the proper channels none the less.

Cheers! :beer:
"How we think determines what we do, and what we do determines what we get."

MexicanCustard

  • Swamp Rat
  • Posts: 705
Re: Fenton Webb's advice re "To dispose or not to dispose"
« Reply #124 on: August 21, 2012, 07:52:45 AM »
I haven't seen anyone comment on the past few articles here.  http://spiderinnet1.typepad.com/blog/ Seems that using ways other than Transaction/StartTransaction may reduce overhead but may introduce other delays.


Tony, I use your database extension methods heavily, thank you BTW.  What are your thoughts on your BlockTableRecord.GetObjects using ObjectId.GetObject instead of using a transaction.  Based on comments in this thread would it be enough of a performance boost to change it to use the top transaction instead?
Revit 2019, AMEP 2019 64bit Win 10

Jeff H

  • Needs a day job
  • Posts: 6144
Re: Fenton Webb's advice re "To dispose or not to dispose"
« Reply #125 on: August 21, 2012, 09:28:12 AM »
Looked like the difference was a call to CheckTopTransaction plus some of Tony's comment
http://www.theswamp.org/index.php?topic=42197.msg473360#msg473360

Jeff H

  • Needs a day job
  • Posts: 6144
Re: Fenton Webb's advice re "To dispose or not to dispose"
« Reply #126 on: August 22, 2012, 02:26:47 AM »
The same applies for any bugs you find in the SDK samples (and if you'd care to summarize to me how the samples are outdated).

On a related note, I agree that the reference guide should do a good job of describing the basic contract for the API. But the days are gone when relatively static SDK and developer guiide samples are the only place people expect to look for code usage information. (Surely people only ever looked there because they couldn't find the information anywhere else)? The first places I (and, I suspect, everyone else on this forum) look for API examples and advice are: blogs (like Through the Interface or DevBlog), forums (like TheSwamp or the Autodesk forums), and websites (like the Autodesk Developer Center or StackOverflow) - or (more generally) we use Google, Bing or whatever is our search engine of choice.

I can only speak for my DevTech team within Autodesk - but this is why we have started (and will continue) to devote a lot of time to putting as much content as we can in the public domain - but (bugs aside) I'm not planning that we'll be retrofitting any information we post to the DevBlogs into the SDK documentation because to do so would be an expensive/inefficient use of people who could instead be creating much more content on our blogs, developer centers and forums.

HTH,

Stephen

And just to reiterate my offer - If someone is interested in sending me a list of documentation omissions and bugs (ideally in order of priority), then I'm very happy to pass it on for you.

Thanks Stephen and Fenton for your input, and appreciate you guys doing what you can help, other than being able take 6+ months for each ADN support request that comes in to produce lacking documentation I am not sure what else you guys could do.
The DevBlog is helpful and appreciate it.
 
I am not sure but unless you guys decide how much resources will be put or spent for producing documentation then it is what it is but I would think the best thing to do is spend it on most common scenarios.
 
I use the docs, but for a particular class or feature unless it directly maps or exposes everything in ObjectARX then there is alot of guesswork, and for common ones you end up spending time in reflector and testing to figure out what is going on.
 
 
That comment link has never worked for me but I just tried and it worked.

Is that the best way to get more resources if everyone just started loading you guys up with comments?


TheMaster

  • Guest
Re: Fenton Webb's advice re "To dispose or not to dispose"
« Reply #127 on: August 23, 2012, 06:09:33 AM »
My previous comments were about the AutoCAD API documentation, but I'm happy to pass on your requests/suggestions for other Autodesk products too.

Well, there seems to have been some progress made on API docs.

  "description to come" has been replaced with "This is method <methodname> of class <classname>".   :roll:

Jeff H

  • Needs a day job
  • Posts: 6144
Re: Fenton Webb's advice re "To dispose or not to dispose"
« Reply #128 on: August 28, 2012, 07:56:04 AM »
Would any of you ARX guys say this is a fair test vs Open Close?
 
Code - C: [Select]
  1.  
  2.   static void HPADArxProject3MyCommand1(void)
  3.  {
  4.   time_t start,end;
  5.   int totalTime=0;
  6.  
  7.   AcDbBlockTable *pBtbl;
  8.   acdbHostApplicationServices()->workingDatabase()->getBlockTable (pBtbl, AcDb::kForRead) ;
  9.   AcDbBlockTableRecord *pModelSpace ;
  10.   time(&start);
  11.   pBtbl->getAt (ACDB_MODEL_SPACE, pModelSpace, AcDb::kForRead) ;
  12.   pBtbl->close () ;
  13.   AcDbBlockTableRecordIterator *pBlockIterator ;
  14.   pModelSpace->newIterator (pBlockIterator, true, true) ;
  15.   pModelSpace->close();
  16.   int index = rand() % 255 + 1;
  17.   AcDbEntity *pEnt;
  18.   Acad::ErrorStatus es;
  19.   for ( ; !pBlockIterator->done () ; pBlockIterator->step () )  
  20.   {  
  21.    pBlockIterator->getEntity(pEnt, AcDb::kForWrite, false);    
  22.    pEnt->setColorIndex(index);
  23.    pEnt->close();
  24.   }
  25.   delete pBlockIterator;
  26.   time(&end);
  27.   totalTime = end-start;
  28.   acutPrintf(_T("\n %i",totalTime));
  29.  }
  30. } ;
  31.  

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8662
  • AKA Daniel
Re: Fenton Webb's advice re "To dispose or not to dispose"
« Reply #129 on: August 28, 2012, 08:03:35 AM »
^ you can use ARXs smart pointers to do cleanup as well

owenwengerd

  • Bull Frog
  • Posts: 451
Re: Fenton Webb's advice re "To dispose or not to dispose"
« Reply #130 on: August 28, 2012, 11:45:08 AM »
Would any of you ARX guys say this is a fair test vs Open Close?

This times open/close AND undo filing. Depending on your goal, this may not be what you want, because the undo filing is (I would guess) going to account for most of the CPU cycles in your test. If you want to time only open/close, remove the call to setColorIndex.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Fenton Webb's advice re "To dispose or not to dispose"
« Reply #131 on: August 29, 2012, 02:18:53 AM »
< .. >
For specific documentation bugs, you can use the 'Comment?' link in the ObjectARX helpfiles to report an issue directly to our TechPubs team (if your default browser settings allow it to work properly  :|). Failing that, you're welcome to report documentation issues via DevHelp Online (if you're an ADN member) or on the appropriate Autodesk discussion group (if you're an ADN member or if you're not). As Fenton says, my DevTech team are much more actively monitoring the 'API' discussion groups these days.

And (because you know my email address, Kerry  :kewl:), you're welcome to send your list of documentation omissions and enhancement requests to me if you like, and I can pass them on to our TechPubs team. They have dedicated API documentation writers, who are quick to fix mistakes or omissions when they are brought to their attention.

< ... >
Stephen

Stephen, The SendComment link does not acknowledge a successful send. Can this be rectified ?

for instance :today :
Quote
acrxProductKey
is listed in the ObjectARX but is NOT available in the API.

Regards

I don't know if this and others are finding a home.

Regards

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

SGP2012

  • Guest
Re: Fenton Webb's advice re "To dispose or not to dispose"
« Reply #132 on: August 31, 2012, 04:39:00 PM »
Thanks Kerry.

Noted and reported.

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2125
  • class keyThumper<T>:ILazy<T>
Re: Fenton Webb's advice re "To dispose or not to dispose"
« Reply #133 on: August 02, 2023, 05:15:14 PM »
Happy birthday to this thread !!  :smitten: 

I come back and visit it regularly.

Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8662
  • AKA Daniel
Re: Fenton Webb's advice re "To dispose or not to dispose"
« Reply #134 on: August 02, 2023, 08:39:49 PM »
Quote
You got to know when to close’em
And not dispose’em
When to delete’em
And when to walk away