Mentions légales du service

Skip to content
Snippets Groups Projects
  • hhakim's avatar
    38d6bfd1
    Move to a weak reference design pattern for Transform objects used in... · 38d6bfd1
    hhakim authored
    Move to a weak reference design pattern for Transform objects used in wrappers. Fix memory leaks for Transform.
    
    Did it directly in C++ with std::shared_ptr into the new TransformHelper class. The shared_ptr is the placeholder for Transform object address. That object is shared by several Py or Matlab Faust objects in a memory opt. goal (typically for one Faust and its transpose). The TransformHelper class hosts the Transform object shared_ptr to which it relies to implement all the functions needed by wrappers.
    The new pattern unifies Py. and Matlab wrappers a little bit more and opens the possibility of a new language wrapper with less complications.
    By the way, Got rid of transpose_flag in wrappers (moved to C++ side), avoiding to modify the result of Faust::Transform functions from the wrapper code after flag consult, rather doing it on C++ side (for example for get_factor() when the Faust is a transpose we needed to transpose the factor into the wrapper. That's no longer needed.).
    Besides, this commit avoids to do a copy in FaustPy.Faust.transpose() because the C++ function TransformHelper::transpose() returns a new TransformHelper object flagged as a transpose (referencing the same underlying Transform object though).
    
    This commit is also a FIX to matlab Faust.delete(): the bug were that when deleting a Faust transpose we lost also the original Faust...
    It likely applies also to py. wrapper (the underlying C++ object could not be deleted). Memory Leak fixed.
    
    Other minor changes:
    - Deletion of shape attribute into py wrapper (directly rely on underlying C++ object function size()).
    - Modification of Faust() constructor to force explicit filepath keyword argument passing if wanting to build Faust from file.
    - ...
    38d6bfd1
    History
    Move to a weak reference design pattern for Transform objects used in...
    hhakim authored
    Move to a weak reference design pattern for Transform objects used in wrappers. Fix memory leaks for Transform.
    
    Did it directly in C++ with std::shared_ptr into the new TransformHelper class. The shared_ptr is the placeholder for Transform object address. That object is shared by several Py or Matlab Faust objects in a memory opt. goal (typically for one Faust and its transpose). The TransformHelper class hosts the Transform object shared_ptr to which it relies to implement all the functions needed by wrappers.
    The new pattern unifies Py. and Matlab wrappers a little bit more and opens the possibility of a new language wrapper with less complications.
    By the way, Got rid of transpose_flag in wrappers (moved to C++ side), avoiding to modify the result of Faust::Transform functions from the wrapper code after flag consult, rather doing it on C++ side (for example for get_factor() when the Faust is a transpose we needed to transpose the factor into the wrapper. That's no longer needed.).
    Besides, this commit avoids to do a copy in FaustPy.Faust.transpose() because the C++ function TransformHelper::transpose() returns a new TransformHelper object flagged as a transpose (referencing the same underlying Transform object though).
    
    This commit is also a FIX to matlab Faust.delete(): the bug were that when deleting a Faust transpose we lost also the original Faust...
    It likely applies also to py. wrapper (the underlying C++ object could not be deleted). Memory Leak fixed.
    
    Other minor changes:
    - Deletion of shape attribute into py wrapper (directly rely on underlying C++ object function size()).
    - Modification of Faust() constructor to force explicit filepath keyword argument passing if wanting to build Faust from file.
    - ...