Skip to content

coded functionObject does not clean up

Summary

tutorial leaks memory

Steps to reproduce

Tutorial tutorials/incompressible/simpleFoam/nonOrthogonalChannel. Run any setup under valgrind.

Environment information

  • OpenFOAM version :feature-nonorthogonal-correction-schemes

Possible fixes

Don't use static inside functionObject. Use e.g.

                regIOobject::store
                (
                    new volScalarField
                    (
                        IOobject
                        (
                            "productionRate",
                            mesh().time().timeName(),
                            mesh(),
                            IOobject::NO_READ,
                            IOobject::AUTO_WRITE
                        ),
                        mesh(),
                        sqr(dimLength)/pow(dimTime, 3)
                    )
                );