Memory leak when assigning allocatable polymorphic variable with return value
问题 I'm struggling with memory management or correct usage of object oriented Fortran 2008. My code has multiple derived types with the same parent (here Example01 and Example02 ) stored in a Example_Class module. I want to load one example in a subroutine workenv depending on some variable (here idx_example ). Whichever one is chosen should be accessed by procedures defined in the base class, so I can do call active_Example%Info() regardless of what active_Example is. The following code compiled