Hello,
I have noticed that calling webservice methods creates memory leaks. It seams that after you delete pending call, it still stays in the momory, so i thought its because webservice and pending call objects are referencing each other creating cross reference and preventing garbage collector from freeing the memory. I found 2 references to webservice in pending call and 1 to pending call in webservice. Deleting them does not help.
Here's code i'm using:
Code:
import mx.services.*;
var pendingCall:PendingCall;
var service:WebService;
//loads wsdl from [DRIVE]:/WSDL.xml
service = new WebService("/WSDL.xml");
function onKeyDown() {
// call webservice method when space is pressed
if (Key.getCode() == Key.SPACE){
trace ("service.GetInfo();");
//instead of calling remote method load xml, that is located in same folder.
service.stub.activePort.GetInfo.endpointURI = "GetInfo.xml";
pendingCall = service.GetInfo();
pendingCall.onResult = function (){
trace ("pendingCall.onResult");
}
}
// delete, when "1" is pressed.
if (Key.getCode() == 49){
trace ("delete all");
delete service.stub.activePort.GetInfo.currentlyActive.originalPromise;
service.stub.activePort.GetInfo.currentlyActive.originalPromise = null;
delete service.stub.callQueue[0];
service.stub.callQueue[0] = null;
delete service.myCall.currentlyActive.originalPromise.myCall.wsdlOperation.wsdl.serviceProxy.service;
service.myCall.currentlyActive.originalPromise.myCall.wsdlOperation.wsdl.serviceProxy.service = null;
delete pendingCall.myCall.wsdlOperation.wsdl.serviceProxy.service;
pendingCall.myCall.wsdlOperation.wsdl.serviceProxy.service = null;
delete pendingCall;
pendingCall = null;
}
}
Key.addListener(this);
Thanks for any help!