这可能导致早先约束到该名字的对象的引用计数降为零,导致释放该对象的分配空间并调用其析构器,如果它有一个的话。
This may cause the reference count for the object previously bound to the name to reach zero, causing the object to be deallocated and its destructor (if it has one) to be called.
那些支持析构函数或垃圾收集器的语言通过在C接口上作一层封装有助于降低这个问题发生的概率。
Programming languages that support destructors or have a garbage collector may mitigate this problem by making a wrapper over the C interface.
程序员无法控制何时调用析构函数,因为这是由垃圾回收器决定的。
The programmer has no control over when the destructor is called because this is determined by the garbage collector.
调用析构函数时,将调用垃圾回收器来处理该队列。
When the destructor is called, the garbage collector is invoked to process the queue.
如果存在析构函数,则将其重写为类终结器。
If a destructor is present, rewrite that to be the class finalizer.
注意,然而,你不需要提供一个析构函数在这种情况下明确:编译器会生成一个隐式你。
Notice, however, that you do not need to provide a destructor explicitly in this case: the compiler will generate one implicitly for you.
例如,无法在析构函数或终结器上请求一个新的槽。
For example, a new slot cannot be requested on a destructor or finalizer.
例如,无法在析构函数或终结器上请求一个新的槽。
For example, a new slot cannot be requested on a destructor or finalizer.
应用推荐