Announcements
The Scaleform forum is now read-only. Please head to the Gamedev site for product support.
Scaleform Forum (Read Only)
Scaleform enables developers to leverage the power of the Adobe® Flash® tool set to create powerful user interface environments for video games.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

More SF Garbage generation...

3 REPLIES 3
Reply
Message 1 of 4
LightStriker
376 Views, 3 Replies

More SF Garbage generation...

In the ongoing process of optimizing our game...


We found out that "Invoke" - the method to call a function in Scaleform - also generates garbage.


It create a Value object to hold the returned data from the function called... even if this function returns nothing.


Since often we do a one-way invoke like "Invoke("UpdateScore", newScore);", we do not care about the returned value. Also, in the case of an updated score, it can easily be called every frame. Garbage generated every frame is never a good thing.


So, we created this in the Value class;

 

        private static Value returnCache = new Value();

        public void InvokeOneWay(String methodName, params object[] objs)
        {
            int numElem = objs.Length;
            IntPtr ptr = Serialize(objs);
#if UNITY_WP8
            bool result = sf_invoke2(this, methodName, numElem, ptr, returnCache);
#else
            bool result = SF_Invoke2(this, methodName, numElem, ptr, returnCache);
#endif
            Marshal.FreeCoTaskMem(ptr);
        }
 

 The return value is static and is never used. Using this reduced our Scaleform garbage generation to almost 0.

3 REPLIES 3
Message 2 of 4
Steve_Curley
in reply to: LightStriker

Tip - [code] tags don't work (this isn't a BBCode forum). Either click the Code button on the message toolbar and paste the code into the resulting dialog, or use <PRE>...</PRE> tags if posting html.

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

Message 3 of 4
LightStriker
in reply to: Steve_Curley

Well... Appears I can't edit it. Oh well.

Message 4 of 4
Steve_Curley
in reply to: LightStriker

30 mins from the time of posting or until the post receives a reply, whichever comes first.
I'll edit the post for you.

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report