Missing destructor


    The Missing Destructor rule checks for PowerBuilder objects that are missing a destructor. A destructor is a method that is automatically called when an object is destroyed. It is used to free up any resources that the object has allocated, such as memory or file handles. If an object is missing a destructor, it can lead to memory leaks and other problems. This rule will generate a warning if an object is missing a destructor.

Key Benefits

  • Ease of use: Missing destructor rule makes it easier to use and understand object-oriented programming.
  • Flexibility: This rule allows for greater flexibility in the design and implementation of objects.
  • Robustness: The rule helps ensure that objects are properly destroyed, which leads to more robust and reliable code.
  • Performance: By properly disposing of objects, the rule helps improve the performance of code.


Non-compliant Code Example

on m_dw.create //Non compliant code
call pfc_m_dw::create
end on

Compliant Code Example

on m_dw.create //Compliant code
call pfc_m_dw::create 
end on

on m_dw.destroy
call pfc_m_dw::destroy
end on
Visual Expert 2024