I'm chasing my tail trying to find an error in my code, and just wanted to ask the question:
If I have a static property that is assigned to an instance of a class, can that instance ever get garbage-collected without a specific delete statement on that instance ?
I have a scenario where a .w is run persistently. During startup, an instance of class foo is assigned to a static public property.
I check for valid-object -
if not this-procedure:persistent then
wait-for close of this-procedure.
message valid-object(dotr.Maia:Project) view-as alert-box.
in the .w , and this displays "yes". So , at this point all is well. However, I have also put a message in the destructor of the class in question.
As soon as I press "ok" on the message, the destructor message is fired, meaning that the class is now being deleted. However, the call stack only shows the line of the destructor.
As there are no more lines of code being executed in the .w. and no lines showing in the call stack, I can only assume that this instance has been garbage collected. However, it was still assigned to the static property.
Any guesses at what might be happening ?
Any guesses at what might be happening ?
>
Running from procedure editor? Never use it for debugging when you have static stuff ... it explicitly goes out and cleans up after itself, and has no idea that you actually want that reference held :).
-- peter
You might also add a message in the instance's destructor and check the stack.
-- peter
no, running from an addon in the toolbar.
However, this may be the issue. Bugger.
err, I did specifically mention that and said that there was no call
stack apart from the destructor
Running from procedure editor? Never use it for debugging when you have static stuff ... it explicitly goes out and cleans up after itself, and has no idea that you actually want that reference held .
Yeah, that a bad trap. I never execute OO code from the old ADE anymore.
so , where do you execute it from ?
Run configurations in OpenEdge Architect?
This is not a runtime solution, It's got to interact with the current
progress environment (build / compile / reload editor contents etc)
Time for an enhancement request I guess...
For persistent procedures there is a trick of having a special internal procedure or function in the PP to save it from AppBuilder's clean up. I doubt it's there for objects - I guess the right way would be having an Interface that tags classes that are o.k. to keep running in the ADE.
But a certain portion of me believes/hopes that there will no manpower be wasted for enhancements to the ADE.
However, it's open source... God bless Dynamics and POSSE! So roll your own AppBuilder
the only trouble is that it is not appbuilder
I am running this from OEA as an extension that is added to the OEA toolbar.
So, why can't you start a fresh AVM?
because it has to interact with the current OEA session, and I don't
have the eclipse API calls
On 31 August 2011 21:20, Thomas Mercer-Hursh
Then, if:
* the purpose is development time behavior and
* the purpose involves interacting with the current AVM
The obvious conclusion is that you either have to rethink your use of statics or you have to expect development involving that static to be painful.
mikefe wrote:
Time for an enhancement request I guess...
For persistent procedures there is a trick of having a special internal procedure or function in the PP to save it from AppBuilder's clean up. I doubt it's there for objects - I guess the right way would be having an Interface that tags classes that are o.k. to keep running in the ADE.
There's nothing like this for classes. The question came up a while ago (I believe a customer logged a WR about it), and I had thought a enhancement request was logged, but I can't find it now, nor the discussion.
I would agree that there should be a simple interface - IPleaseDontKillMeKindSir ? - that would signal this. OEA uses adecomm/_runcode.p which is the thing that, um, runs the code. It also does the cleanup. So your wish might be granted.
-- peter
pjudge schrieb:
mikefe wrote:
Time for an enhancement request I guess...
For persistent procedures there is a trick of having a special internal procedure or function in the PP to save it from AppBuilder's clean up. I doubt it's there for objects - I guess the right way would be having an Interface that tags classes that are o.k. to keep running in the ADE.
There's nothing like this for classes. The question came up a while ago (I believe a customer logged a WR about it), and I had thought a enhancement request was logged, but I can't find it now, nor the discussion.
I would agree that there should be a simple interface - IPleaseDontKillMeKindSir ? - that would signal this. OEA uses adecomm/_runcode.p which is the thing that, um, runs the code. It also does the cleanup. So your wish might be granted.
-- peter
So it should be pretty easy for an experienced guy like Julian to add that himself.
Since you have access to adecomm/_runcode.p via possenet download you can work around it with just a few lines of code.
Make a copy, put it in your project/propath, then change it to not kill/ignore objects that implement a specific interface. The interface doesn't need to have any methods on it. Or you can run dynamic-invoke no-error on it looking for a specific method being present/not present if you don't want to go the interface route.
Should be pretty straight forward.
For giggles here is the ade code:
http://communities.progress.com/pcom/docs/DOC-106818
And attached is an UNTESTED implementation of IPleaseDontKillMeKindSir.
I've compiled it to r-code so if you can't be bothered to compile it yourself, you can use as is.
mattB
Disclaimer: this code is in no way supported by anyone, anywhere. It is merely here to demonstrate a technique. Use at your own risk.
ah, you are too kind
the main "surprise" was that I was not expecting the object to be
deleted, as I still had the window open. I'll dig further.
On 31 August 2011 22:02, Thomas Mercer-Hursh
I'll have a look at that. Thanks
ah, you are too kind
Man, you are presenting at www.pugchallenge.eu - you are an expert!
However, it's open source... God bless Dynamics and POSSE! So roll your own AppBuilder
I remember seeing this *waaaaay* back in the day ... http://sourceforge.net/projects/openappbuilder/
-- peter
heh! lol.
them were the days