Steps to Reproduce
- The attached project is just a new opengl project with very small modifications to show this bug. A new thread is created to just continuously try and write to the sd card, the function is called DoThread(). The other modification is just to allocate some memory then set the variable to null each time OnRenderFrame is called, the allocation is large to give the GC something to dispose of. I also call GC.Collect(); just to make sure it is called each frame, the same effect happens if you dont force the GC however it can take a little longer to happen.
- Run the attached project (preferably on mid or low range devices) and notice that the time between renders of frames which is output to the android log can be very delayed, on a samsung galaxy note 2 it can take up to 7 seconds between frames.
TestMemoryAlloc.zip
Expected Behavior
The render thread should continue rendering with only 30ms of delay from the garbage collector like normally happens.
Actual Behavior
The render thread can be delayed up to 7 seconds when the writing a file on another thread. I tested on an android 4.4, android 5.0 and android 7.0, the 7.0 had a much faster storage device so the effect was less but still up to 400ms. I also had similar results with File.Copy(string source, string destination) I also had similar results creating a native C++ dll to do the file write. I first noticed this issue when doing a File.Copy and it was a large file which resulted in 3 seconds of freeze on all the threads.
Version Information
Microsoft Visual Studio Community 2017
Version 15.6.4
VisualStudio.15.Release/15.6.4+27428.2015
Microsoft .NET Framework
Version 4.7.02556
Installed Version: Community
Visual C++ 2017 00369-60000-00001-AA611
Microsoft Visual C++ 2017
Application Insights Tools for Visual Studio Package 8.11.10212.1
Application Insights Tools for Visual Studio
ASP.NET and Web Tools 2017 15.0.40314.0
ASP.NET and Web Tools 2017
ASP.NET Core Razor Language Services 1.0
Provides languages services for ASP.NET Core Razor.
Azure App Service Tools v3.0.0 15.0.40215.0
Azure App Service Tools v3.0.0
C# Tools 2.7.0-beta3-62715-05. Commit Hash: db02128e6e3c4bdfc93e6ec425ac9162b4d4fe80
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
JavaScript Language Service 2.0
JavaScript Language Service
JavaScript Project System 2.0
JavaScript Project System
JetBrains ReSharper Ultimate 2017.3.3 Build 111.0.20180302.65130
JetBrains ReSharper Ultimate package for Microsoft Visual Studio. For more information about ReSharper Ultimate, visit http://www.jetbrains.com/resharper. Copyright © 2018 JetBrains, Inc.
Merq 1.1.17-rc (cba4571)
Command Bus, Event Stream and Async Manager for Visual Studio extensions.
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers
Microsoft Visual C++ Wizards 1.0
Microsoft Visual C++ Wizards
Microsoft Visual Studio VC Package 1.0
Microsoft Visual Studio VC Package
Mono Debugging for Visual Studio 4.9.11-pre (71eb098)
Support for debugging Mono processes with Visual Studio.
Node.js Tools 1.4.11027.3
Adds support for developing and debugging Node.js apps in Visual Studio
NuGet Package Manager 4.6.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.
ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info
TypeScript Tools 15.6.20202.3
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 2.7.0-beta3-62715-05. Commit Hash: db02128e6e3c4bdfc93e6ec425ac9162b4d4fe80
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual C++ for Cross Platform Mobile Development (Android) 15.0.27428.2015
Visual C++ for Cross Platform Mobile Development (Android)
Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio
Visual Studio Tools for CMake 1.0
Visual Studio Tools for CMake
VisualStudio.Mac 1.0
Mac Extension for Visual Studio
Xamarin 4.9.0.752 (0faa808ee)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Designer 4.10.58 (cee1369d0)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Xamarin.Android SDK 8.2.0.16 (HEAD/a78295902)
Xamarin.Android Reference Assemblies and MSBuild support.
Xamarin.iOS and Xamarin.Mac SDK 11.8.1.28 (3979d08)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
Log File
log.zip
Steps to Reproduce
TestMemoryAlloc.zip
Expected Behavior
The render thread should continue rendering with only 30ms of delay from the garbage collector like normally happens.
Actual Behavior
The render thread can be delayed up to 7 seconds when the writing a file on another thread. I tested on an android 4.4, android 5.0 and android 7.0, the 7.0 had a much faster storage device so the effect was less but still up to 400ms. I also had similar results with File.Copy(string source, string destination) I also had similar results creating a native C++ dll to do the file write. I first noticed this issue when doing a File.Copy and it was a large file which resulted in 3 seconds of freeze on all the threads.
Version Information
Microsoft Visual Studio Community 2017
Version 15.6.4
VisualStudio.15.Release/15.6.4+27428.2015
Microsoft .NET Framework
Version 4.7.02556
Installed Version: Community
Visual C++ 2017 00369-60000-00001-AA611
Microsoft Visual C++ 2017
Application Insights Tools for Visual Studio Package 8.11.10212.1
Application Insights Tools for Visual Studio
ASP.NET and Web Tools 2017 15.0.40314.0
ASP.NET and Web Tools 2017
ASP.NET Core Razor Language Services 1.0
Provides languages services for ASP.NET Core Razor.
Azure App Service Tools v3.0.0 15.0.40215.0
Azure App Service Tools v3.0.0
C# Tools 2.7.0-beta3-62715-05. Commit Hash: db02128e6e3c4bdfc93e6ec425ac9162b4d4fe80
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
JavaScript Language Service 2.0
JavaScript Language Service
JavaScript Project System 2.0
JavaScript Project System
JetBrains ReSharper Ultimate 2017.3.3 Build 111.0.20180302.65130
JetBrains ReSharper Ultimate package for Microsoft Visual Studio. For more information about ReSharper Ultimate, visit http://www.jetbrains.com/resharper. Copyright © 2018 JetBrains, Inc.
Merq 1.1.17-rc (cba4571)
Command Bus, Event Stream and Async Manager for Visual Studio extensions.
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers
Microsoft Visual C++ Wizards 1.0
Microsoft Visual C++ Wizards
Microsoft Visual Studio VC Package 1.0
Microsoft Visual Studio VC Package
Mono Debugging for Visual Studio 4.9.11-pre (71eb098)
Support for debugging Mono processes with Visual Studio.
Node.js Tools 1.4.11027.3
Adds support for developing and debugging Node.js apps in Visual Studio
NuGet Package Manager 4.6.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.
ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info
TypeScript Tools 15.6.20202.3
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 2.7.0-beta3-62715-05. Commit Hash: db02128e6e3c4bdfc93e6ec425ac9162b4d4fe80
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual C++ for Cross Platform Mobile Development (Android) 15.0.27428.2015
Visual C++ for Cross Platform Mobile Development (Android)
Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio
Visual Studio Tools for CMake 1.0
Visual Studio Tools for CMake
VisualStudio.Mac 1.0
Mac Extension for Visual Studio
Xamarin 4.9.0.752 (0faa808ee)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Designer 4.10.58 (cee1369d0)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Xamarin.Android SDK 8.2.0.16 (HEAD/a78295902)
Xamarin.Android Reference Assemblies and MSBuild support.
Xamarin.iOS and Xamarin.Mac SDK 11.8.1.28 (3979d08)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
Log File
log.zip