Please note: this project is inactive since early 2006
4.7.2 Controlling the finalization stage
There are circumstances where the default behaviour is not what you want.
For example:
-
if your model does not define any relationships, you know you can safely
skip invalidating your objects.
-
If you are using an EditingContext in a batch that loads and
processes lots and lots of objects, say 10,000 objects, after which the
process simply dies, you really don't want to wait for python to invalidate
every single objects, simply because this can take hours (I saw a python
process stuck on this for an hour before I lost patience and killed
it). You'd probably prefer to let the operating system release the
memory allocated to the dying process.
Here is how you can control the finalization stage:
- EditingContext.invalidatesObjectsWhenFinalized_default
- is a class
attribute that controls the global behaviour for all EditingContext instances
except those which were specifically configured (see below). If
set to true, all existing and future EditingContexts will invalidate their
objects when they are destroyed, otherwise they won't.
- EditingContext.setInvalidatesObjectsWhenFinalized()
- controls
whether a specific EditingContext instance invalidates its objects when it's
been disposed. Note that this setting supersedes the previous one.
Comments are welcome: Sebastien Bigaret / Modeling Home Page
Hosted by: