msg-byu / kgridGen

Generator for Generalized Regular k-point grids
6 stars 6 forks source link

Memory Leak in generateIrredKpointList #20

Closed JohnEdChristensen closed 6 years ago

JohnEdChristensen commented 6 years ago

The KpList, pgOps, and trans variables are not deallocated in this function. After calling this function thousands of times my program ended up using over 5 gigs of memory.

This is fixed by simply adding deallocate(KpList,pgOps,trans) to the end of this function. That is all that my pull request changes.

glwhart commented 6 years ago

Did this actually fix it? Fortran has automatic garbage collection. Often a deallocate is unnecessary---objects are automatically taken care of when the function/subroutine is exited.

JohnEdChristensen commented 6 years ago

This completely fixed my problem. The program went from using multiple Gib of memory, to only using 200 Kib.