[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
MysterX changes exp-tagged
If you use COM, you probably know that COM
uses a reference-counting mechanism. Every
COM class supports the AddRef and Release
methods to increment and decrement its count.
When an object's reference count goes to zero,
its resources can be reclaimed.
While developing MysterX, I found it necessary
to call AddRef() on some COM objects obtained from
functions; otherwise, all kinds of funny things
(like crashes) would happen.
But calling AddRef() should not have been necessary.
Indeed, most of the time, this works fine.
The solution used in recent versions of MysterX
was to *always* call AddRef() on obtained COM objects.
Of course, that means that COM objects that
are correctly reference-counted are not
deallocated when a GC occurs. So that approach
leaves a lot of junk around.
I've exp-tagged some changes to the MysterX code.
I've removed the automatic AddRef. Instead,
there are two new procedures
com-add-ref
com-ref-count
The first of these forces an AddRef on the COM
object supplied as an argument. The second returns
the current reference count for a COM object.
Yes, exposing the reference-counting mechanism
at the Scheme level is ugly, but I can't think of a better
way to deal with this problem. Most of the time, it
should not be necessary to use these procedures.
If you're a MysterX user, please try out this new
code. I'd like to know if your programs remain stable
with the new code. I've tried it out with three
programs here, and things seem fine. I'd like
some assurance from others before releasing a new
version.
-- Paul
----------------------------------------------------------------
| Paul Steckler, Ph.D. | Rice University PLT |
| steck@cs.rice.edu | DrScheme Project |
| Tel: 713/348-3814 | http://www.cs.rice.edu/~steck |
| FAX: 713/348-5930 | *** Ad astra per hackera *** |
----------------------------------------------------------------