Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Switching to another APP version
Message
From
03/05/2018 09:11:58
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Title:
Switching to another APP version
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01659712
Message ID:
01659712
Views:
70
Hi All,

We have an application that uses a series of APPs that match the version of the dataset. E.g. a dataset is version 23, then SET('PATH') and SET('PROC') will point to a subfolder with version 23 of the application. When switching to another dataset (e.g. to 24), the switch to the apps of 24 is also made. The routine that does the switch does several things to get rid of stuff in memory.

The application processes a list of datasets. Each dataset can be of a certain version (not all datasets are converted in a big-bang to the latest version of the application).

This routine worked well for many years, but now there is one instance that the application continues to use the APP of the previously processed dataset. (It is an APP that contains a class created with createobject(). In the closing section the object variable is released.)

What should I also release, clear or sys()? Btw, sys(1104) didn't help.
*	This routine ensures that tcslib, techlib and userlog are specific for the version of the data.
*	Returns whether or not the required version is supported. Can be either an existing 
*	version or a missing.
*	If the new version is not supported, it will retain the previous settings.
FUNCTION switchMPSLibs( tcToPath )
	local lcToPath, llOK, lcMPSAppPath

	lcToPath = m.tcToPath
	
	if vartype( m.glLoggingEnabled ) = 'L' and m.glLoggingEnabled
		*
		if vartype( m.goUserlog ) = 'O'
			goUserlog = NULL
		endif
	endif

	lcMPSAppPath = m.gcMPSAppsDir + m.lcToPath

	llOK      = file( m.lcMPSAppPath + '\techlib.app' )

	if m.llOK

		if not ( m.gcCurrentMPSVersion == m.lcToPath )
	
			gcCurrentMPSVersion = m.lcToPath
			*
			if atc( 'techlib.app', set( 'proc' ) ) > 0
				release procedure techlib.app
			endif

			if atc( 'tcslib.app', set( 'proc' ) ) > 0
				release procedure tcslib.app
			endif
			
			if atc( 'versionlib.app', set( 'proc' ) ) > 0
				release procedure versionlib.app
			endif

			if atc( 'mps.exe', set( 'proc' ) ) > 0
				release procedure mps.exe
			endif

			removePaths( m.gcMPSAppsDir )		&& removes e.g. 'mpsapps\23'
			
			clear program

			P_APPDIR = addbs( m.lcMPSAppPath )		&& might be used in tcslib, etc.
			
			set path to ( m.lcMPSAppPath )  additive

			set procedure to mps.exe        additive
			set procedure to tcslib.app     additive
			set procedure to techlib.app    additive
			set procedure to versionlib.app additive	&& however, will be the one in the main folder

			InitVersionLib()							&& will further set up the lib
		endif

		glLoggingEnabled = file( 'userlog.app' )
		*
		if not m.glLoggingEnabled
			goUserLog = NULL
		endif
	endif
	
	RETURN m.llOK
Groet,
Peter de Valença

Constructive frustration is the breeding ground of genius.
If there’s no willingness to moderate for the sake of good debate, then I have no willingness to debate at all.
Let's develop superb standards that will end the holy wars.
"There are three types of people: Alphas and Betas", said the beta decisively.
If you find this message rude or offensive or stupid, please take a step away from the keyboard and try to think calmly about an eventual a possible alternative explanation of my message.
Next
Reply
Map
View

Click here to load this message in the networking platform