Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove obsolete code in DEBUG_MEM* sections #371

Merged
merged 2 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions include/SW_Control.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ void SW_CTL_main(SW_ALL* sw, SW_OUTPUT_POINTERS* SW_OutputPtrs,
void SW_CTL_run_current_year(SW_ALL* sw, SW_OUTPUT_POINTERS* SW_OutputPtrs,
LOG_INFO* LogInfo);

#ifdef DEBUG_MEM
void SW_CTL_SetMemoryRefs(SW_OUTPUT SW_Output[]);
#endif


#ifdef __cplusplus
}
Expand Down
4 changes: 0 additions & 4 deletions include/SW_Files.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ void SW_F_construct(char *InFiles[], const char *firstfile, char _ProjDir[],
void SW_F_deconstruct(char *InFiles[]);
void SW_CSV_F_INIT(const char *s, LOG_INFO* LogInfo);

#ifdef DEBUG_MEM
void SW_F_SetMemoryRefs(void);
#endif


#ifdef __cplusplus
}
Expand Down
4 changes: 0 additions & 4 deletions include/SW_Markov.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ void SW_MKV_setup(SW_MARKOV* SW_Markov, unsigned long Weather_rng_seed,
void SW_MKV_today(SW_MARKOV* SW_Markov, TimeInt doy0, TimeInt year,
RealD *tmax, RealD *tmin, RealD *rain, LOG_INFO* LogInfo);

#ifdef DEBUG_MEM
void SW_MKV_SetMemoryRefs( void);
#endif


#ifdef __cplusplus
}
Expand Down
5 changes: 0 additions & 5 deletions include/SW_Output.h
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,6 @@ void get_biomass_SXW(OutPeriod pd, SW_ALL* sw);
#endif


#ifdef DEBUG_MEM
void SW_OUT_SetMemoryRefs(SW_OUTPUT SW_Output[]);
#endif


#ifdef __cplusplus
}
#endif
Expand Down
4 changes: 0 additions & 4 deletions include/SW_Site.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,6 @@ void set_soillayers(SW_VEGPROD* SW_VegProd, SW_SITE* SW_Site,
void derive_soilRegions(SW_SITE* SW_Site, int nRegions,
RealD *regionLowerBounds, LOG_INFO* LogInfo);

#ifdef DEBUG_MEM
void SW_SIT_SetMemoryRefs(void);
#endif


#ifdef __cplusplus
}
Expand Down
4 changes: 0 additions & 4 deletions include/SW_SoilWater.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,6 @@ double SWRC_SWPtoSWC_FXW(
void SW_WaterBalance_Checks(SW_ALL* sw, LOG_INFO* LogInfo);
#endif

#ifdef DEBUG_MEM
void SW_SWC_SetMemoryRefs(void);
#endif


#ifdef __cplusplus
}
Expand Down
4 changes: 0 additions & 4 deletions include/SW_Weather.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,6 @@ void SW_WTH_new_day(SW_WEATHER* SW_Weather, SW_SITE* SW_Site, RealD snowpack[],
void SW_WTH_sum_today(void);


#ifdef DEBUG_MEM
void SW_WTH_SetMemoryRefs(void);
#endif


#ifdef __cplusplus
}
Expand Down
53 changes: 0 additions & 53 deletions include/memblock.h

This file was deleted.

3 changes: 0 additions & 3 deletions include/myMemory.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
#include "include/SW_datastructs.h"


#ifdef DEBUG_MEM
#include "include/memblock.h"
#endif

#ifdef __cplusplus
extern "C" {
Expand Down
29 changes: 0 additions & 29 deletions src/SW_Control.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,32 +370,3 @@ void SW_CTL_read_inputs_from_disk(SW_ALL* sw, PATH_INFO* PathInfo,
if (debug) swprintf(" completed.\n");
#endif
}



#ifdef DEBUG_MEM
#include "include/SW_Markov.h" /* for setmemrefs function */

/**
@brief This routine sets the known memory refs so they can be
checked for leaks, etc. Includes malloc-ed memory in
SOILWAT. All refs will have been cleared
by a call to ClearMemoryRefs() before this, and will be
checked via CheckMemoryRefs() after this, most likely in
the main() function.
*/
void SW_CTL_SetMemoryRefs(SW_OUTPUT SW_Output[]) {
/* when debugging memory problems, use the bookkeeping
code in myMemory.c

*/

SW_F_SetMemoryRefs();
SW_OUT_SetMemoryRefs(SW_Output);
SW_SWC_SetMemoryRefs();
SW_SIT_SetMemoryRefs();
SW_WTH_SetMemoryRefs();
SW_MKV_SetMemoryRefs();
}

#endif
21 changes: 0 additions & 21 deletions src/SW_Files.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,24 +253,3 @@ void SW_F_deconstruct(char *InFiles[]) {
}
}
}
#ifdef DEBUG_MEM
#include "include/myMemory.h"
/*======================================================*/
void SW_F_SetMemoryRefs( void) {
/* when debugging memory problems, use the bookkeeping
code in myMemory.c
This routine sets the known memory refs in this module
so they can be checked for leaks, etc. Includes
malloc-ed memory in SOILWAT. All refs will have been
cleared by a call to ClearMemoryRefs() before this, and
will be checked via CheckMemoryRefs() after this, most
likely in the main() function.
*/
SW_FileIndex i;

for ( i=eFirst; i < eEndFile; i++)
NoteMemoryRef(InFiles[i]);

}

#endif
27 changes: 0 additions & 27 deletions src/SW_Markov.c
Original file line number Diff line number Diff line change
Expand Up @@ -646,30 +646,3 @@ void SW_MKV_setup(SW_MARKOV* SW_Markov, unsigned long Weather_rng_seed,
);
}
}


#ifdef DEBUG_MEM
#include "include/myMemory.h"
/*======================================================*/
void SW_MKV_SetMemoryRefs( void) {
/* when debugging memory problems, use the bookkeeping
code in myMemory.c
This routine sets the known memory refs in this module
so they can be checked for leaks, etc. All refs will
have been cleared by a call to ClearMemoryRefs() before
this, and will be checked via CheckMemoryRefs() after
this, most likely in the main() function.
*/

NoteMemoryRef(SW_Markov.wetprob);
NoteMemoryRef(SW_Markov.dryprob);
NoteMemoryRef(SW_Markov.avg_ppt);
NoteMemoryRef(SW_Markov.std_ppt);
NoteMemoryRef(SW_Markov.cfxw);
NoteMemoryRef(SW_Markov.cfxd);
NoteMemoryRef(SW_Markov.cfnw);
NoteMemoryRef(SW_Markov.cfnd);

}

#endif
25 changes: 0 additions & 25 deletions src/SW_Output.c
Original file line number Diff line number Diff line change
Expand Up @@ -2658,31 +2658,6 @@ void _echo_all_inputs(SW_ALL* sw, LOG_INFO* LogInfo) {
}


#ifdef DEBUG_MEM
#include "include/myMemory.h"
/** when debugging memory problems, use the bookkeeping
code in myMemory.c
This routine sets the known memory refs in this module
so they can be checked for leaks, etc. Includes
malloc-ed memory in SOILWAT. All refs will have been
cleared by a call to ClearMemoryRefs() before this, and
will be checked via CheckMemoryRefs() after this, most
likely in the main() function.
*/
void SW_OUT_SetMemoryRefs(SW_OUTPUT SW_Output[])
{
OutKey k;

ForEachOutKey(k)
{
if (SW_Output[k].use)
//NoteMemoryRef(SW_Output[k].outfile);
}

}

#endif


/*==================================================================*/
/**
Expand Down
22 changes: 0 additions & 22 deletions src/SW_Site.c
Original file line number Diff line number Diff line change
Expand Up @@ -2612,25 +2612,3 @@ void _echo_inputs(SW_SITE* SW_Site, LOG_INFO* LogInfo) {
);
//fflush(LogInfo);
}

#ifdef DEBUG_MEM
#include "include/myMemory.h"
/*======================================================*/
void SW_SIT_SetMemoryRefs( void) {
/* when debugging memory problems, use the bookkeeping
code in myMemory.c
This routine sets the known memory refs in this module
so they can be checked for leaks, etc. All refs will
have been cleared by a call to ClearMemoryRefs() before
this, and will be checked via CheckMemoryRefs() after
this, most likely in the main() function.
*/
LyrIndex l;

NoteMemoryRef(SW_Site.lyr);
ForEachSoilLayer(l) {
NoteMemoryRef(SW_Site.lyr[l]);
}
}

#endif
28 changes: 0 additions & 28 deletions src/SW_SoilWater.c
Original file line number Diff line number Diff line change
Expand Up @@ -1855,31 +1855,3 @@ double SWRC_SWPtoSWC_FXW(
// convert matric theta [cm / cm] to bulk SWC [cm]
return (1. - gravel) * width * res;
}




/**
@brief This routine sets the known memory refs in this module
so they can be checked for leaks, etc.
*/

#ifdef DEBUG_MEM
#include "include/myMemory.h"
/*======================================================*/
void SW_SWC_SetMemoryRefs( void) {
/* when debugging memory problems, use the bookkeeping
code in myMemory.c
This routine sets the known memory refs in this module
so they can be checked for leaks, etc. Includes
malloc-ed memory in SOILWAT. All refs will have been
cleared by a call to ClearMemoryRefs() before this, and
will be checked via CheckMemoryRefs() after this, most
likely in the main() function.
*/

/* NoteMemoryRef(SW_Soilwat.hist.file_prefix); */

}

#endif
16 changes: 0 additions & 16 deletions src/SW_Weather.c
Original file line number Diff line number Diff line change
Expand Up @@ -2088,19 +2088,3 @@ void deallocateClimateStructs(SW_CLIMATE_YEARLY *climateOutput,
free(climateOutput->maxTempMon_C);
free(climateOutput->minTempMon_C);
}

#ifdef DEBUG_MEM
#include "include/myMemory.h"
/*======================================================*/
void SW_WTH_SetMemoryRefs( void) {
/* when debugging memory problems, use the bookkeeping
code in myMemory.c
This routine sets the known memory refs in this module
so they can be checked for leaks, etc. All refs will
have been cleared by a call to ClearMemoryRefs() before
this, and will be checked via CheckMemoryRefs() after
this, most likely in the main() function.
*/
}

#endif
Loading