[gmx-developers] freeing nbnxn_atomdata_t array
Mark Abraham
mark.j.abraham at gmail.com
Wed Jun 10 20:15:58 CEST 2015
Hi,
On Wed, Jun 10, 2015 at 7:23 PM Mirabzadeh, Christopher (
mira2978 at vandals.uidaho.edu) <mira2978 at vandals.uidaho.edu> wrote:
> I’m not sure what file you are editing but I’ll attempt an answer at
> this. What I’ve noticed is that there is a Gromacs wrapper for free()
> called “sfree()”. I can’t recall where I’ve found it defined but I’ve used
> it in my own code to free memory allocated for arrays. What you may find is
> that the array is either freed in the .c file that you are editing, or you
> may find that it is freed where it is initialized, if a pointer. In my own
> project, the arrays that I am taking advantage of are defined and freed in
> src/gromacs/gmxlib/typedefs.c.
>
> If the file you are editing is a .cpp, the garbage collection may be
> automatic, but that depends on the structure type.
>
No, mdrun likely will never do garbage collection, for multiple reasons.
Various smart pointers are on the way in, but if you're allocating heap
memory each MD step then you need to go and re-think the pace of your life
;-)
I hope that helps!
>
> Cheers,
>
> -ChrisM
>
> Mirabzadeh, Christopher
> Research Assistant/Physics Instructor
> Department of Physics
> University of Idaho
> Moscow, Id
> (509)339-5647
>
>
>
> On Jun 9, 2015, at 3:26 PM, Sikandar Mashayak <mashayak at votca.org> wrote:
>
> Hi,
>
> I am trying to find out the location in the source code where the arrays,
> e..g, real *x, of the structure nbnxn_atomdata_t are freed?
>
>
Probably they are not freed (because mdrun is currently built to be good
enough to run a single simulation and then terminate), but the intent is to
allocate and free such arrays using the function pointer members of
nbnxn_atomdata_t. Search for alloc and free in nbnxn_atomdata.c
> Are they freed explicitly or they are automatically deallocated when the
> program ends.
>
> Unix processes have their memory reclaimed by the OS when they terminate;
currently there is no "destructor" ever called for such arrays. That's
dirty, but sufficient what is currently normal GROMACS usage.
Mark
> Thanks,
> Sikandar
> --
> Gromacs Developers mailing list
>
> * Please search the archive at
> http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List before
> posting!
>
> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>
> * For (un)subscribe requests visit
> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers
> or send a mail to gmx-developers-request at gromacs.org.
>
>
>
> --
> Gromacs Developers mailing list
>
> * Please search the archive at
> http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List before
> posting!
>
> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>
> * For (un)subscribe requests visit
> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers
> or send a mail to gmx-developers-request at gromacs.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.sys.kth.se/pipermail/gromacs.org_gmx-developers/attachments/20150610/95dd5c81/attachment.html>
More information about the gromacs.org_gmx-developers
mailing list