Freeing memory / clearing cache after videosphere stops - aframe

Is there a way to manually deallocate memory or clear cache after a videosphere is done playing? I'm using A-Frame on iOS with Cordova for a video project (not ideal tech combo, but my hands are tied there), but after a few videos the app crashes on attempting to play the next one.

Try digging into the texture cache and disposing it: Aframe asset unload
May or may not work.

Related

Deadlock in AudioKit after connecting/disonnecting audio hardware

I'm using AudioKit (4.11.2) in my app to replay audio files.
When try to start a player after connecting/disconnecting audio hardware, there is often a deadlock in main thread. The same also happens when loading or unloading a player after connecting/disconnecting audio hardware.
Especially, when the connected/disconnected device is an Apple AirPod Pro headset, then it's reproducible by 100%.
See image with call stack on deadlock.
Image with call stack of deadlocks
I know that AudioKit 4.11.2 is not the latest, but it is the latest 4.x release. I cannot yet switch to 5.x due to the breaking change of missing AKPlayer class.
Is there any known issue with deadlocks after connecting/disconnecting audio hardware?
I already switched off AKSettings.enableCategoryChangeHandling and AKSettings.enableRouteChangeHandling, but that didn't help.
P.S:
In the mean time I migrated to AudioKit 5.3.2 and use the class AudioPlayer instead of AKPlayer and the issue is still the same.
After many hours and hours of debugging I found that it must be an Apple bug.
Reading lastRenderTime (AKManager.engine.outputNode.lastRenderTime on AudioKit 4 or avEngine.outputNode.lastRenderTime on an instance of AudioEngine on AudioKit 5) causes the problem.
As long as I never read lastRenderTime, I can connect/disconnect the AirPod Pro headset and play the audio file without any problems.
Once I read lastRenderTime, after next connect/disconnect of the AirPod Pro headset the main thread freezes when trying to start the player.
(lastRenderTime on AVAudioNode is an Apple function, not an AudioKit function.)

How to determine cause of DirectX 11 driver hang

I am working on a QT application for which I've integrated DirectX 11 into a custom widget. The application renders a scrolling display - a graphical representation of data being read from a file. The user can speed up and slow down the scrolling speed.
For the most part, this is working great. The DirectX 11 rendering is presented to my custom widget just as I'd expect. The problem is that the graphics driver randomly hangs and crashes my program. I say "random" because I have been testing this with the same data file and it never seems to crash at the same point in the file, after a specific amount of time, or at a specific scrolling speed (the faster the scrolling speed, the more work being done by the GPU per frame).
When the application hangs, my screen freezes for a moment, goes black, then returns with a nice message from NVidia that it has recovered from a driver crash. The Debug Output in Visual Studio contains the following:
D3D11: Removing Device.
D3D11 ERROR: ID3D11Device::RemoveDevice:
Device removal has been triggered for the following reason
(DXGI_ERROR_DEVICE_HUNG: The Device took an unreasonable amount of
time to execute its commands, or the hardware crashed/hung. As a
result, the TDR (Timeout Detection and Recovery) mechanism has been
triggered. The current Device Context was executing commands when the
hang occurred. The application may want to respawn and fallback to
less aggressive use of the display hardware). [ EXECUTION ERROR #378:
DEVICE_REMOVAL_PROCESS_AT_FAULT]
I have discovered that by simply commenting out the IDXGISwapChain1::Present call, the application will run through the file at blazing speed. Graphics-wise it is still pushing data to the GPU and drawing to render targets, it just never gets displayed to my window.
What I'm hoping for is help with ideas of what types of things cause driver hangs. My shaders are incredibly simple - basically just positioning my vertices using a projection matrix. And considering what I described in the above paragraph, shaders should still be cranking through vertices and pixels even when Present isn't being called, yes?
I was suspicious that this could be a compatibility issue with Qt - I know DirectX isn't officially supported by Qt. So I tried creating a separate window using CreateWindowEx and using that for my swap chain instead of the custom Qt widget. It rendered to that window but also hung the driver just like before.
I was also suspicious of a driver bug in my laptop, so I tried running the application on a beefier desktop PC that regularly runs another DirectX 11 application (non-Qt) without a hitch (worth mentioning that this other application renders similar data in a scrolling display as well, using shaders that are a lot more complex). But my QT application hangs the driver on that PC as well.
Anyone know of a way I can get a more detailed description of what is causing the driver to hang?
Thank you in advance for any help you can offer.
UPDATE: 2013-08-01 17:16 CST
I am currently investigating a possible thread syncing issue that may be the culprit. Will continue tomorrow morning and post if I solve this on my own.
After some testing today, it appears to have been a threading issue. I have run several times today with no graphics crash. So my problem must be fixed, unless I've just been getting lucky with my tests today (or unlucky, rather - if this shows its ugly face again in a day or two).
I was aware that the immediate device context is not thread safe. Rather than using deferred contexts, though, I was using critical sections to sync my threads and coordinate use of the device context. What I did not realize is that it is not safe to call IDXGISwapChain1::Present while another thread is using the device context. Makes sense, but since it is not call directly from the device context itself, I overlooked it. I literally moved my Present() call a few lines up into my critical section block, and it hasn't given me a crash since.

BlackBerry Webworks app crash with blank alert box - How to debug?

I've created a BlackBerry webworks application that consists of multiple pages each loading data from a local SQLite database.
The application works fine until I've navigated between a certain number of pages, at which time the application shows a blank alert box and hangs on the loading screen that shows between pages.
This is using the Bold 9700 simulator but also occurs on the device itself. I've tried disabling caching, as well as increasing the size of the cache, both to no avail. The console shows nothing, neither does the event log on the simulator.
Has anyone come across this behaviour before? More importantly, how do I get any useful debug information out of the simulator so I can track down the culprit?
Many thanks!
Edit: I've tracked this down the the html5_init.js library that Blackberry recommend for translating HTML5 to Google Gears calls for OS5. Any ideas?
Further Edit: I've removed all traces of html5_init.js and instead I'm using the Google Gears API directly. This resolves the problem but requires that I double up all my database code. Google Gears requires that you call clear() on all ResultSets so that they don't cause a memory leak but html5_init doesn't offer that functionality. Maybe that could be the cause?

How to get Flex app to load quicker?

We've got an app written in Flex that displays data from our app. The .swf file is only 427kb, but it takes a full five seconds to load in Firefox. This is a headache for our users because they need to access the page that contains the app frequently. (The app displays documents, and it's really slow to march through a list of them).
I've confirmed that it's not a slow web server problem. The .swf appears to be cached in the browser. Firebug reports that every time the web page accesses the .swf, the app server returns a "304 Not Modified" response, meaning that the load time from the server is almost zero.
Is there anything we can do to debug this issue? Or is the Flash player just slow?
If you're having issues with the time to download the SWF or to initialize the application, you could try breaking it up into modules and using the SWFLoader to only load the pieces as you need them. Flex applications are 2-frame movies, so the more you have in your application the more there is to initialize before it can start "playing."
If it's slow rendering everything, take a look at the creationPolicy and see if you're needlessly creating a hierarchy of items that aren't being displayed. Repeaters are also notorious for rendering slowly.
If your performance problems are more in-application, then you could consider profiling your application to see where the hotspots are.
Have you tried running the app using the Flex Profiler? That may help you isolate any performance issues.
Consider checking out the Flex RSLs. These runtime shared libraries allow the Flash Player to cache the Flex framework and after the first load allow for a much faster startup time.
Look at the
creationPolicy documentation.. it may help..
The default should be "auto"... Creates all controls only in the initial view of the navigator container. This setting causes a faster startup time for the application, but results in slower response time for user navigation.
This setting is the default for multiple-view containers.
See if someone has changed your setting.

4.6 QWebView memory leaks?

I wrote a quick test app to use the google analytics scripts in a client app. It works fine using QWebView and
QWebFrame* pFrame = m_pWebView->page()->mainFrame();
pFrame->setContent(arrayHtml);
pFrame->evaluateJavaScript(strScript);
But no matter what I do I cannot get it to release memory. Every time I call the script it keeps adding to memory used in the process. I even try delete m_pWebView and the memory usage is still there. I also tried the QWebSettings::clearMemoryCaches() call and it did not work.
Is this a memory leak or is there some other magic I can use to get it to not consume all the PC's memory.

Resources