[cig-commits] r12560 - seismo/3D/SPECFEM3D_GLOBE/trunk/version41_beta/src

dkomati1 at geodynamics.org dkomati1 at geodynamics.org
Wed Aug 6 14:32:07 PDT 2008


Author: dkomati1
Date: 2008-08-06 14:32:07 -0700 (Wed, 06 Aug 2008)
New Revision: 12560

Modified:
   seismo/3D/SPECFEM3D_GLOBE/trunk/version41_beta/src/get_global.f90
Log:
converted get_global.f90 from heap to stack


Modified: seismo/3D/SPECFEM3D_GLOBE/trunk/version41_beta/src/get_global.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/trunk/version41_beta/src/get_global.f90	2008-08-06 21:27:54 UTC (rev 12559)
+++ seismo/3D/SPECFEM3D_GLOBE/trunk/version41_beta/src/get_global.f90	2008-08-06 21:32:07 UTC (rev 12560)
@@ -50,15 +50,10 @@
   integer ispec,i,j
   integer ieoff,ilocnum,nseg,ioff,iseg,ig
 
-  integer, dimension(:), allocatable :: ind,ninseg,iwork
-  double precision, dimension(:), allocatable :: work
+! allocate these automatic arrays in the memory stack to avoid memory fragmentation with "allocate()"
+  integer, dimension(npointot) :: ind,ninseg,iwork
+  double precision, dimension(npointot) :: work
 
-! dynamically allocate arrays
-  allocate(ind(npointot))
-  allocate(ninseg(npointot))
-  allocate(iwork(npointot))
-  allocate(work(npointot))
-
 ! establish initial pointers
   do ispec=1,nspec
     ieoff=NGLLX * NGLLY * NGLLZ * (ispec-1)
@@ -126,12 +121,6 @@
 
   nglob=ig
 
-! deallocate arrays
-  deallocate(ind)
-  deallocate(ninseg)
-  deallocate(iwork)
-  deallocate(work)
-
   end subroutine get_global
 
 ! -----------------------------------



More information about the cig-commits mailing list