Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BUG: skip the Assign destroy object or fire a C5 crash
Message
From
12/04/2004 09:43:01
 
 
To
12/04/2004 05:50:34
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00893546
Message ID:
00894026
Views:
17
Hey Fabio,
I read your code and unless I'm missing something here I believe this is the exact same problem that I have run across. The problem is still the object reference assignment isn't being made in the _Assign method. As long as this assignment isn't being made VFP internal memory is being corrupted.

I've alter your simplified code slightly for different results that I'm sure you'd eventually come acros if you had'nt yet. Look for "&& Fabio" for my comments. Also I finally got to work and I'm going to post MS response to me that explains the problem. I'll post it on this thread but in a defferent replay.
RunCode()
? 'Cycle 2'
RunCode()

FUNCTION RunCode()
* IF YOU USE persistent reference, C5 AND MEMORY LEAK DISAPPEAR
LOCAL oObjectFactory as Object, oProducedObject as Object 

	oObjectFactory = CREATEOBJECT("ObjectFactory")
	oProducedObject = oObjectFactory.ReturnAnObject()

&& Fabio
&& with every thing else the same this line of code not cause C5's
&& this will also fix the corrupt memory problem. 
	oObjectFactory = .null.
&& Comment out the previous line of code C5's return
&& End of comment to Fabio
ENDFUNC 

DEFINE CLASS ObjectFactory as Custom
	oObjectRef = ""

	FUNCTION ReturnAnObject() as Object
	LOCAL oObjectRef as Object

		oObjectRef = CREATEOBJECT("ProducedObject")	&& the C5 is fired here !!!
		? 'PUNTO 2'
		oObjectRef.Configuration = M.THIS
		RETURN M.oObjectRef
	ENDFUNC 
ENDDEFINE 

DEFINE CLASS ProducedObject as Custom

	Configuration = ""

	DIMENSION MemberArray1(1)
	DIMENSION MemberArray2(1)
	DIMENSION MemberArray3(1)
	DIMENSION MemberArray4(1)
	DIMENSION MemberArray5(1)
	DIMENSION MemberArray6(1)

	FUNCTION Configuration_Assign(oObjectRef as object)	
	ENDFUNC 
ENDDEFINE 
Memory leak code:
RunCode()
? 'Cycle 2'
RunCode()

FUNCTION RunCode()
* IF YOU USE persistent reference, C5 AND MEMORY LEAK DISAPPEAR
LOCAL oObjectFactory as Object, oProducedObject as Object 
	oObjectFactory = CREATEOBJECT("ObjectFactory")
	oProducedObject = oObjectFactory.ReturnAnObject()
ENDFUNC 

DEFINE CLASS ObjectFactory as Custom
	oObjectRef = ""

	FUNCTION ReturnAnObject() as Object
	LOCAL oObjectRef as Object

		oObjectRef = CREATEOBJECT("ProducedObject")	&& the C5 is fired here !!!
		? 'PUNTO 2'
		oObjectRef.Configuration = M.THIS
		RETURN M.oObjectRef
	ENDFUNC 
ENDDEFINE 

DEFINE CLASS ProducedObject as Custom
	Configuration = ""
&& Fabio
&& with this class definition C5's will not appear but
&& will cause a huge Memory leak.  
&& End of comments to Fabio

	DIMENSION MemberArray1(1)
	DIMENSION MemberArray2(1)
	DIMENSION MemberArray3(1)

	FUNCTION Configuration_Assign(oObjectRef as object)	
	ENDFUNC 
ENDDEFINE 
Thanks Fabio
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform