One of the most important things to implement when authoring a pool is a suitable object lifetime policy.
在创作池时需要实现的最重要的功能之一是适当的对象生存期策略。
This includes the control object lifetime behavior, in particular the handling of the described memory leak problem.
这包括控件对象生存期行为,特别是对所描述的内存泄漏问题的处理。
Whenever you can, avoid finalizers because of the additional performance overhead that is involved in tracking object lifetime.
应尽可能避免终结器,因为跟踪对象生存期会产生额外的性能系统开销。
The weak event pattern can also be used whenever the object lifetime of the source exceeds the useful object lifetime of the listener.
当源的对象生存期超出侦听器的有用对象生存期时,也可以使用弱事件模式。
To minimize the work required on a per-object basis, the default should minimize the objects for which you must specify the object lifetime.
为使针对平均每个对象所需执行的工作最小化,默认设置应使需要指定生存期的对象个数最少。
You can also collect object lifetime data that shows you the size and number of objects that are reclaimed in each garbage collection generation.
您还可以收集对象生存期数据,这些数据显示每代垃圾回收中所回收的对象的大小和数目。
Most of the time, good software engineering techniques ensure that this happens automatically, without us having to expend a lot of attention on the issue of object lifetime.
在大多数时候,好的软件工程技术保证这是自动实现的,不用我们对对象生命周期问题花费过多心思。
Whenever the source object lifetime extends beyond the object lifetime of the listener, the normal event pattern leads to a memory leak: the listener is kept alive longer than intended.
如果源对象生存期超出了侦听器的对象生存期,则常规事件模式会导致内存泄漏:侦听器保持活动状态的时间比预期要长。
If you are not careful, this can be the lifetime of your program — such as when you place an object in a global collection.
如果不小心,那么它可能就与程序的生命周期一样——如果将一个对象放入一个全局集合中的话。
Whenever you add a listener to an object, you need to ask yourself what the listener's lifetime is and to which object you're adding the listener.
不管什么时候要向某个对象中添加侦听器,您都需要自问一下,侦听器被添加到哪个对象,侦听器的生命期有多长。
To maintain the integrity of objects with different lifetimes, you must follow one rule when referencing objects: an object may not reference another object with a shorter lifetime.
要维护具有不同生存期的对象的完整性,在引用这些对象时必须遵守一条规则:一个对象可能不能引用另一个具有更短生存期(与自身比较)的对象。
Lifetime (creation) policy improvements - Importers can request a specific creation policy for an injected object.
(创建期)生存策略的增强——导入器(Importer)能够为一个注入的对象请求一个特别的创建策略。
If the developer forgets to call XyzRelease, then resources are leaked because the compiler doesn't help to track the lifetime of an object instance.
假如开发者忘记调用XyzRelease函数,那时资源就会泄露,因为编译器不能跟踪一个对象实例的生命周期。
While the bundle base name is fixed for the lifetime of the Msg object, you can switch the locale used by the Msg object by calling its setLocale() method (its default is the JVM's default locale).
“绑定包的名称”在Msg对象的生命周期内将一直存在,可以通过调用 Msg 对象的 setLocale() 来切换语言环境(默认语言环境是JVM 使用的语言环境)。
When you copy an object reference using an ordinary (strong) reference, you constrain the lifetime of the referent to be at least as long as that of the copied reference.
用一个普通的(强)引用拷贝一个对象引用时,限制referent的生命周期至少与被拷贝的引用的生命周期一样长。
On the other hand, creating a PreparedStatement object introduces a certain amount of overhead, so, ideally, the statement's lifetime will be sufficiently long to compensate for this overhead.
在另一个方面,建立一个PreparedStatement对象会带来一定量的系统开销。所以,在理想情况下,这条语句的生命周期应该足够长,以补偿它所带来的系统开销。
In the previous installment, we saw how weak references can provide an application with an alternate means of reaching an object while it is used by the program, but without prolonging its lifetime.
在前一期文章中我们看到了,弱引用如何可以给应用程序提供当对象被程序使用时另一种到达该对象的方法,但是不会延长对象的生命周期。
It has at least the same lifetime as the function object (absent something funky).
它具有至少相同的寿命为函数对象(没有什么时髦的)。
On the other hand, when you create a weak reference to an object, you do not extend the lifetime of the referent at all; you simply maintain an alternate way to reach it while it is still alive.
另一方面,在创建对一个对象的弱引用时,完全没有扩展referent的生命周期,只是在对象仍然存活的时候,保持另一种到达它的方法。
The allocate() method lets you allocate an object with a given lifetime. For example, when no parameters are required
allocate()方法让您能够分配具有给定生存期的对象。
There's another issue, however, and that's the lifetime of an object.
这里还有一个问题,就是对象的生存时间。
Rust (+ SFML) - How to avoid extra object construction when limited by lifetime parameters?
锈(+SFML)-如何避免额外的对象构造时,有限的寿命参数?
In this example, the name of the object should not change during its lifetime.
在这个例子里,对象的名字在它的生命周期内不应该被改变。
Where is the data for an object and how is the lifetime of the object controlled?
对象的数据被放在哪里,它的生命周期如何?
An object has a storage duration (3.7) which influences its lifetime (3.8).
对象具有存储类型(3.7),并影响它的寿命(3.8)。
The state object provides associated information throughout the lifetime of the operation.
状态对象在操作的整个生存期内提供相关的信息。
A lease can specify that an object has an infinite lifetime.
租约可以指定某对象具有无限长的生存期。
This method is used to explicitly control the lifetime of a COM object used from managed code.
此方法用于显式控制从托管代码使用的COM对象的生存期。
This method is used to explicitly control the lifetime of a COM object used from managed code.
此方法用于显式控制从托管代码使用的COM对象的生存期。
应用推荐