Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

is it possible to have one instance of an actor throughout the entire application? I have noticed in my code when ever a res option in a tag uses an actor's vfs it called the create instance function. I think I am doing something wrong in trigml code but i am not sure what.

Any ideas how I can do this?

Thanks,

Mike.

Hi,
Yes, By default an application will have a single instance of an actor. That instance MAY not live for the entire life of the application so you may see the actor destroyed and recreated as it is referanced. This is particularly true if you are in a low memory situation.
Its hard to debug without some code... Also hard to guess where the problem might be...
First up put a break point or DBGPRINTF in your actor in the top nodes release function if you have one. You can use this to see if the actor is being destroyed. This will tell you if some how the actor frame work is creating more than one instance or if it is just that your instance is being destroyed then recreated. There is a simple solution to this problem if it turns out to be the issue. Let me know how you get on.
If this gives no clue you could post or email some code I can take a quick look. It might be hard to debug without seeing the entire source for the actor though which I guess you will be unable to give.
Hope that helps
James

Hi,
Yes, By default an application will have a single instance of an actor. That instance MAY not live for the entire life of the application so you may see the actor destroyed and recreated as it is referanced. This is particularly true if you are in a low memory situation.
Its hard to debug without some code... Also hard to guess where the problem might be...
First up put a break point or DBGPRINTF in your actor in the top nodes release function if you have one. You can use this to see if the actor is being destroyed. This will tell you if some how the actor frame work is creating more than one instance or if it is just that your instance is being destroyed then recreated. There is a simple solution to this problem if it turns out to be the issue. Let me know how you get on.
If this gives no clue you could post or email some code I can take a quick look. It might be hard to debug without seeing the entire source for the actor though which I guess you will be unable to give.
Hope that helps
James

What I noticed is when I go place a breakpoint in the release method its never zero until the end. So does this mean that only one instance is being created or more than one different pointers are pointing at it?
I also placed a breakpoint in the entry point to the actor and noticed it gets called more than once? So does that mean another actor has been created?
MikeH.

What I noticed is when I go place a breakpoint in the release method its never zero until the end. So does this mean that only one instance is being created or more than one different pointers are pointing at it?
I also placed a breakpoint in the entry point to the actor and noticed it gets called more than once? So does that mean another actor has been created?
MikeH.

as far as I have readed, that number is the number of references that your actor has, so at the end it must be 0

as far as I have readed, that number is the number of references that your actor has, so at the end it must be 0

MikeH wrote:What I noticed is when I go place a breakpoint in the release method its never zero until the end. So does this mean that only one instance is being created or more than one different pointers are pointing at it?
I also placed a breakpoint in the entry point to the actor and noticed it gets called more than once? So does that mean another actor has been created?
MikeH.
Hi
If the release only goes to 0 at the end of the trig (ie when you close your application) then it should be the single and only instance for the life time of the application. This is what I would expect. There are a number of reasons why the entry point could get called more than once:
1. Another application is using the actor. Actors are not singletons across differant trigs only within the context of an application.
2. The mif file says that the extension containing your actors exports some other clsid or actor that is also being created.
3. There is a problem and for some reason the player no longer thinks the actor exists so is recreating it.
The best way to tell if the Actor itself, rather than some other thing in the extension is being recreated would be to put a Breakpoint in the createNode function of your actor loader (this is the bit of code that impliments IActorLoader. Search for this in your code and it should be obvious what I mean). If the breakpoint is hit more than once in the life time of the application have a look back in the call stack to see if another application is invoking it. From what you have described with the release I expect that it will only get hit once and everything is working fine if however it gets hit more than once by the same application there is probably a problem in the actor.
Let me know how you get on.
Hope this helps
James

MikeH wrote:What I noticed is when I go place a breakpoint in the release method its never zero until the end. So does this mean that only one instance is being created or more than one different pointers are pointing at it?
I also placed a breakpoint in the entry point to the actor and noticed it gets called more than once? So does that mean another actor has been created?
MikeH.
Hi
If the release only goes to 0 at the end of the trig (ie when you close your application) then it should be the single and only instance for the life time of the application. This is what I would expect. There are a number of reasons why the entry point could get called more than once:
1. Another application is using the actor. Actors are not singletons across differant trigs only within the context of an application.
2. The mif file says that the extension containing your actors exports some other clsid or actor that is also being created.
3. There is a problem and for some reason the player no longer thinks the actor exists so is recreating it.
The best way to tell if the Actor itself, rather than some other thing in the extension is being recreated would be to put a Breakpoint in the createNode function of your actor loader (this is the bit of code that impliments IActorLoader. Search for this in your code and it should be obvious what I mean). If the breakpoint is hit more than once in the life time of the application have a look back in the call stack to see if another application is invoking it. From what you have described with the release I expect that it will only get hit once and everything is working fine if however it gets hit more than once by the same application there is probably a problem in the actor.
Let me know how you get on.
Hope this helps
James

I did that and I found with my new trigML application its only creating one instance of the actor. I used two pages, the first page prints out one string and a second page prints the same string. Placed breakpoints in the createNode and in the CreateChild functions (I am using CacheContainer). These functions are only being called once.
Thanks,
Mike.

I did that and I found with my new trigML application its only creating one instance of the actor. I used two pages, the first page prints out one string and a second page prints the same string. Placed breakpoints in the createNode and in the CreateChild functions (I am using CacheContainer). These functions are only being called once.
Thanks,
Mike.

Hi
Thats good news :-)
Sounds to me like its all working as it should.
Thanks
James

Hi
Thats good news :-)
Sounds to me like its all working as it should.
Thanks
James