.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Disposing of Result Buffers

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
387 Views, 3 Replies

Disposing of Result Buffers

A am probably being paranoid/anal about this but I would like to know the following from any of the experts out there:

Given that according to all documentation on the subject result buffers must be diposed of explicitly after use as follows (VB.Net):

Dim rb as ResultBuffer = obj.Xdata
Dim rbArray as TypedValue() = rb.AsArray
.
..Use it somehow..
.
.
rb.Dispose()

Is there anything wrong with creating the result buffer and using it on the fly? Such as as in:

Dim rbArray as TypedValue() = obj.XData.AsArray

Is the disposal handled inside of a wrapper somewhere?? Normally in straight VB/C# I'm quite happy that there is no problem, but I don't want to end up with some hard to find bugs/crashes relating to undisposed of result buffers .
3 REPLIES 3
Message 2 of 4
chiefbraincloud
in reply to: Anonymous

I have used Obj.XData.AsArray without any difficulty. I assume that the disposal is taken care of behind the scenes, but I can't say for certain.
Dave O.                                                                  Sig-Logos32.png
Message 3 of 4
Anonymous
in reply to: Anonymous

ResultBuffer has a Finalizer that deletes the unmanaged resbuf chain when
Dispose() is called. If you don't call Dispose(), the finalizer still runs
when the garbage collector destroys the instance.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009

http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");


wrote in message news:6214009@discussion.autodesk.com...
A am probably being paranoid/anal about this but I would like to know the
following from any of the experts out there:

Given that according to all documentation on the subject result buffers must
be diposed of explicitly after use as follows (VB.Net):

Dim rb as ResultBuffer = obj.Xdata
Dim rbArray as TypedValue() = rb.AsArray
..
..Use it somehow..
..
..
rb.Dispose()

Is there anything wrong with creating the result buffer and using it on the
fly? Such as as in:

Dim rbArray as TypedValue() = obj.XData.AsArray

Is the disposal handled inside of a wrapper somewhere?? Normally in
straight VB/C# I'm quite happy that there is no problem, but I don't want to
end up with some hard to find bugs/crashes relating to undisposed of result
buffers .
Message 4 of 4
Anonymous
in reply to: Anonymous

Thanks guys forv taking the time. I've had no problem myself using obj.XData.AsArray but was just wondering during an idle moment.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost