On 2011/9/30 István Csanády wrote:
> Thanks Thomas, this solved the leaking issue. Any ideas for a workaround for
> the MMGrOpt crash (when I don't remove gcurve.GetObject())? Or I will have
> to wait for pyocc 0.6?

Hello,

Can you please check whether your crash happens with OCE 0.6.0?  We
fixed a bug which looks similar, so maybe it is gone.
If it crashes, how can I reproduce it?  I tried your
example_GC_istvan.py file with MMGT_OPT set to 0, but it does not
crash.

> Last night I have been profiling some pythonocc code and I have noticed that
> collect_object is a quite slow even if I remove logging. Probably it has
> some potential to increase pythonocc's performance. Since it is always
> called when an object is destructed it makes sense to remove somehow the
> costly string compares for the Handle objects. For example if it is possible
> in OCE in the Handle class generator (handle classes are generated
> automatically, aren't they?) can be modified that every Handle class should
> subclass from an empty marker class (eg. class HandleMarkerClass{}) and this
> can be used in the GC by checking only
> isinstance(obj_deleted,HandleMarkerClass), removing
> the obj_deleted.__class__.__name__.startswith('Handle').

AFAICT all handles derive from either Handle_Standard_Transient or
Handle_Standard_Persistent, so your solution can be implemented
without changes in C++ code.

> The hasattr calls
> might also can be replaced by some tricky way but I don't know if it worth
> it but I think it does since hasattr searches in a python dictionary which
> is a hashmap and a single isinstance is might be less costly than a dict
> lookup. But replacing somehow the string compare IMO would definitely worth
> it.
> But these are only ideas I don't know OCC's structure very well.

I guess that
  hasattr(obj_deleted,"GetHandle")
can be replaced by
  isinstance(deleted, OCC.Standard.Standard_Transient) or
isinstance(deleted, OCC.Standard.Standard_Persistent)

Denis

_______________________________________________
Pythonocc-users mailing list
Pythonocc-users@gna.org
https://mail.gna.org/listinfo/pythonocc-users

Reply via email to