Skip to content

Commit 89fab01

Browse files
committed
release input context memory from config blocks
1 parent a3d3f14 commit 89fab01

2 files changed

Lines changed: 34 additions & 17 deletions

File tree

make/makefile

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,8 @@ $(OBJDIR)/HGeoUtil.o \
415415
$(OBJDIR)/gwf-vsc.o \
416416
$(OBJDIR)/GwfNpfOptions.o \
417417
$(OBJDIR)/GwfConductanceUtils.o \
418+
$(OBJDIR)/VirtualBase.o \
419+
$(OBJDIR)/STLVecInt.o \
418420
$(OBJDIR)/ParticleTracks.o \
419421
$(OBJDIR)/ParticleReleaseSchedule.o \
420422
$(OBJDIR)/MethodModel.o \
@@ -450,6 +452,11 @@ $(OBJDIR)/ImsLinearMisc.o \
450452
$(OBJDIR)/gwf-npf.o \
451453
$(OBJDIR)/GwfBuyInputData.o \
452454
$(OBJDIR)/GweCndOptions.o \
455+
$(OBJDIR)/VirtualDataLists.o \
456+
$(OBJDIR)/VirtualDataContainer.o \
457+
$(OBJDIR)/SimStages.o \
458+
$(OBJDIR)/IndexMap.o \
459+
$(OBJDIR)/ArrayReaderBase.o \
453460
$(OBJDIR)/prt-prp.o \
454461
$(OBJDIR)/prt-oc.o \
455462
$(OBJDIR)/prt-mip.o \
@@ -486,29 +493,20 @@ $(OBJDIR)/gwe-est.o \
486493
$(OBJDIR)/gwe-esl.o \
487494
$(OBJDIR)/gwe-ctp.o \
488495
$(OBJDIR)/gwe-cnd.o \
489-
$(OBJDIR)/VirtualBase.o \
490-
$(OBJDIR)/STLVecInt.o \
491-
$(OBJDIR)/prt.o \
492-
$(OBJDIR)/olf.o \
493-
$(OBJDIR)/gwt.o \
494-
$(OBJDIR)/gwf.o \
495-
$(OBJDIR)/gwe.o \
496-
$(OBJDIR)/chf.o \
497-
$(OBJDIR)/VirtualDataLists.o \
498-
$(OBJDIR)/VirtualDataContainer.o \
499-
$(OBJDIR)/SimStages.o \
500-
$(OBJDIR)/IndexMap.o \
501-
$(OBJDIR)/ArrayReaderBase.o \
502-
$(OBJDIR)/ModelPackageInput.o \
503496
$(OBJDIR)/VirtualModel.o \
504497
$(OBJDIR)/BaseExchange.o \
505498
$(OBJDIR)/InterfaceMap.o \
506499
$(OBJDIR)/SeqVector.o \
507500
$(OBJDIR)/ImsLinearSettings.o \
508501
$(OBJDIR)/ConvergenceSummary.o \
509502
$(OBJDIR)/Integer2dReader.o \
503+
$(OBJDIR)/prt.o \
504+
$(OBJDIR)/olf.o \
505+
$(OBJDIR)/gwt.o \
506+
$(OBJDIR)/gwf.o \
507+
$(OBJDIR)/gwe.o \
508+
$(OBJDIR)/chf.o \
510509
$(OBJDIR)/ModflowInput.o \
511-
$(OBJDIR)/ModelPackageInputs.o \
512510
$(OBJDIR)/DefinitionSelect.o \
513511
$(OBJDIR)/CellWithNbrs.o \
514512
$(OBJDIR)/NumericalExchange.o \
@@ -522,6 +520,7 @@ $(OBJDIR)/NCFileVars.o \
522520
$(OBJDIR)/Integer1dReader.o \
523521
$(OBJDIR)/Double2dReader.o \
524522
$(OBJDIR)/Double1dReader.o \
523+
$(OBJDIR)/ModelPackageInput.o \
525524
$(OBJDIR)/LoadContext.o \
526525
$(OBJDIR)/VirtualExchange.o \
527526
$(OBJDIR)/GridSorting.o \
@@ -588,6 +587,7 @@ $(OBJDIR)/DistributedSim.o \
588587
$(OBJDIR)/exg-chfgwf.o \
589588
$(OBJDIR)/RunControl.o \
590589
$(OBJDIR)/SourceLoad.o \
590+
$(OBJDIR)/ModelPackageInputs.o \
591591
$(OBJDIR)/SimulationCreate.o \
592592
$(OBJDIR)/RunControlFactory.o \
593593
$(OBJDIR)/IdmLoad.o \

src/Model/GroundWaterFlow/gwf-maw.f90

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module MawModule
2828
use SimVariablesModule, only: errmsg, warnmsg
2929
use MemoryManagerModule, only: mem_allocate, mem_reallocate, mem_setptr, &
3030
mem_deallocate, get_isize
31-
use MemoryManagerExtModule, only: mem_set_value
31+
use MemoryManagerExtModule, only: mem_set_value, memorystore_release
3232
use MemoryHelperModule, only: create_mem_path
3333
use CharacterStringModule, only: CharacterStringType
3434
use OpenSpecModule, only: access, form
@@ -50,7 +50,7 @@ module MawModule
5050
!> @brief input context data pointers for MAW.
5151
!!
5252
!! Holds persistent pointers to input context arrays used at
53-
!! runtime. TS arrays are managed transparently by IDM.
53+
!! runtime.
5454
!<
5555
type :: MawInputContextType
5656
! -- packagedata
@@ -947,6 +947,14 @@ subroutine maw_source_packagedata(this)
947947
end do
948948
this%iaconn(n + 1) = idx + 1
949949
end do
950+
!
951+
! -- release input context packagedata memory; PACKAGEDATA_IFNO excluded
952+
! because allocate_featureauxvar retains a pointer to it
953+
call memorystore_release('RADIUS', this%input_mempath)
954+
call memorystore_release('BOTTOM', this%input_mempath)
955+
call memorystore_release('CONDEQN', this%input_mempath)
956+
call memorystore_release('NGWFNODES', this%input_mempath)
957+
call memorystore_release('BOUNDNAME', this%input_mempath)
950958
end subroutine maw_source_packagedata
951959

952960
!> @brief Source CONNECTIONDATA block from input context
@@ -1171,6 +1179,15 @@ subroutine maw_source_connectiondata(this)
11711179
if (count_errors() > 0) then
11721180
call store_error_filename(this%input_fname)
11731181
end if
1182+
!
1183+
! -- release input context connectiondata memory
1184+
call memorystore_release('CONNDATA_IFNO', this%input_mempath)
1185+
call memorystore_release('ICON', this%input_mempath)
1186+
call memorystore_release('CELLID', this%input_mempath)
1187+
call memorystore_release('SCRN_TOP', this%input_mempath)
1188+
call memorystore_release('SCRN_BOT', this%input_mempath)
1189+
call memorystore_release('HK_SKIN', this%input_mempath)
1190+
call memorystore_release('RADIUS_SKIN', this%input_mempath)
11741191
end subroutine maw_source_connectiondata
11751192

11761193
!> @brief Read the initial parameters for this package

0 commit comments

Comments
 (0)