grewegreg
IS-IT--Management
- Apr 1, 2007
- 23
I have been working on a project for sometime (VFP 9, SP1) where I have to create several objects that are in a .NET API. In order to access its methods and events, I need to instantiate an object for that class and then get at least one or two interfaces of that object. At any given moment, I will need to (minimally) have two separate objects instantiated and up to four interfaces.
After instantiating the objects and its interfaces, the computer runs fine. But as soon as I call any method (that returns a result), the processor is pegged at 100%. The code does not give up the CPU Utilization until you exit the application completely. Disconnecting or calling the Interfaces "Dispose" method does not release the CPU, not does storing a .NULL. to the object or releasing the form that instantiated the objects.
I guess I am just curious to see if anyone else has experienced anything similar to this. I have written a quick .NET application with C#, instantiate the objects and interfaces, but I cannot reproduce the CPU utilization problem when the application runs.
I have posted snippets of the code below, if that may help anyone see if I am doing anything badly... Thanks in advance.
I have tried creating these objects as public variables, but the same affect.
Greg Grewe
Diamond Consulting, LLC
After instantiating the objects and its interfaces, the computer runs fine. But as soon as I call any method (that returns a result), the processor is pegged at 100%. The code does not give up the CPU Utilization until you exit the application completely. Disconnecting or calling the Interfaces "Dispose" method does not release the CPU, not does storing a .NULL. to the object or releasing the form that instantiated the objects.
I guess I am just curious to see if anyone else has experienced anything similar to this. I have written a quick .NET application with C#, instantiate the objects and interfaces, but I cannot reproduce the CPU utilization problem when the application runs.
I have posted snippets of the code below, if that may help anyone see if I am doing anything badly... Thanks in advance.
Code:
THISFORM.roClass = CREATEOBJECT('namespace.class')
THISFORM.roClassInterFace = GETINTERFACE(THISFORM.roClass,'InterfaceName')
IF ... THEN
Set Properties
Call Methods
*!* Processor gets pegged here...
etc...
ELSE
ENDIF
THISFORM.roClassInterFace.Dispose()
*!* No affect
STORE .NULL. TO THISFORM.roClassInterFace
STORE .NULL. TO THISFORM.roClass
THISFORM.Release()
I have tried creating these objects as public variables, but the same affect.
Greg Grewe
Diamond Consulting, LLC