Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

4.6 iOS 64-bit beta

Discussion in 'iOS and tvOS' started by jonas-echterhoff, Jan 12, 2015.

  1. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,779
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,779
    @pushxtonotdie

    Thanks for submitting this bug, we will investigate it. We did have some problems with WebRequest and threads about a month ago. We were able to resolve them, and we have not heard about many problems since then. Your issues sounds very similar though.

    If there is anything else you can do to help us reproduce issues like this, we would appreciate it, as they are often tough to track down without a full project or a complex situation. Thanks.
     
  3. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,779
  4. andymads

    andymads

    Joined:
    Jun 16, 2011
    Posts:
    1,614
    Hi.

    Seem to have a IL2CPP crash under 4.6.6 that I didn't have yesterday with 4.6.5.

    In il2cpp::vm::Runtime::GetInterfaceInvokeData(unsigned int, TypeInfo*, void*). Happens every time on dev and non-dev builds.

    Have sent complete project.
    Bug #702922.

    Screen Shot 2015-06-09 at 15.11.56.png Screen Shot 2015-06-09 at 15.12.07.png
     
  5. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,779
    @andymads

    Thanks, we will investigate it.
     
  6. Nakano37

    Nakano37

    Joined:
    Jan 13, 2011
    Posts:
    7
    Just grabbed the new 4.6.6p1 patch build and while I was building fine on 4.6.6f2, I'm now getting a compile error:

    IL2CPP error for type 'Matrix.XPathFilter' in assembly '/Users/username/Documents/code/project-trunk/games/project/Temp/StagingArea/Data/Managed/Matrix.dll'
    Additional information: Build a development build for more information. Cannot cast from source type to destination type.

    Output from the development build is:

    Code (CSharp):
    1. Failed running /Applications/Unity/Unity.app/Contents/Frameworks/il2cpp/build/il2cpp.exe --copy-level=None --emit-null-checks --enable-array-bounds-check --extra-types.file="/Applications/Unity/Unity.app/Contents/Frameworks/il2cpp/il2cpp_default_extra_types.txt" --assembly="/Users/username/Documents/code/project-trunk/games/project/Temp/StagingArea/Data/Managed/Assembly-CSharp.dll" --assembly="/Users/username/Documents/code/project-trunk/games/project/Temp/StagingArea/Data/Managed/Assembly-UnityScript.dll" --assembly="/Users/username/Documents/code/project-trunk/games/project/Temp/StagingArea/Data/Managed/UnityEngine.UI.dll" --assembly="/Users/username/Documents/code/project-trunk/games/project/Temp/StagingArea/Data/Managed/AssetFetcher.dll" --assembly="/Users/username/Documents/code/project-trunk/games/project/Temp/StagingArea/Data/Managed/core.dll" --assembly="/Users/username/Documents/code/project-trunk/games/project/Temp/StagingArea/Data/Managed/Ionic.Zlib.dll" --assembly="/Users/username/Documents/code/project-trunk/games/project/Temp/StagingArea/Data/Managed/JsonFx.dll" --assembly="/Users/username/Documents/code/project-trunk/games/project/Temp/StagingArea/Data/Managed/Matrix.dll" --assembly="/Users/username/Documents/code/project-trunk/games/project/Temp/StagingArea/Data/Managed/NGUI.dll" --assembly="/Users/username/Documents/code/project-trunk/games/project/Temp/StagingArea/Data/Managed/P31RestKit.dll" --assembly="/Users/username/Documents/code/project-trunk/games/project/Temp/StagingArea/Data/Managed/project-core.dll" --assembly="/Users/username/Documents/code/project-trunk/games/project/Temp/StagingArea/Data/Managed/project-src.dll" --assembly="/Users/username/Documents/code/project-trunk/games/project/Temp/StagingArea/Data/Managed/project-type-init.dll" --assembly="/Users/username/Documents/code/project-trunk/games/project/Temp/StagingArea/Data/Managed/protobuf-net.dll" --assembly="/Users/username/Documents/code/project-trunk/games/project/Temp/StagingArea/Data/Managed/ProtobufMessages.dll" --assembly="/Users/username/Documents/code/project-trunk/games/project/Temp/StagingArea/Data/Managed/ProtobufSerializer.dll" --assembly="/Users/username/Documents/code/project-trunk/games/project/Temp/StagingArea/Data/Managed/System.Xml.Linq.dll" --assembly="/Users/username/Documents/code/project-trunk/games/project/Temp/StagingArea/Data/Managed/type_init.dll" --assembly="/Users/username/Documents/code/project-trunk/games/project/Temp/StagingArea/Data/Managed/util.dll" --assembly="/Users/username/Documents/code/project-trunk/games/project/Temp/StagingArea/Data/Managed/zxing.dll" --generatedcppdir="/Users/username/Documents/code/project-trunk/games/project/Temp/il2cppOutput/il2cppOutput" --builder=none
    2.  
    3. stdout;
    4. IL2CPP error for type 'Matrix.XPathFilter' in assembly '/Users/username/Documents/code/project-trunk/games/project/Temp/StagingArea/Data/Managed/Matrix.dll'
    5. Additional information: Build a development build for more information. Cannot cast from source type to destination type.
    6. il2cpp.exe didn't catch exception: System.InvalidCastException: Cannot cast from source type to destination type.
    7.  at Unity.IL2CPP.Metadata.Fields.FieldDefaultValue.ConstantDataFor (Mono.Cecil.FieldDefinition field) [0x00000] in <filename unknown>:0
    8.  at Unity.IL2CPP.Metadata.Fields.FieldDefaultValue+<FromType>c__Iterator6.MoveNext () [0x00000] in <filename unknown>:0
    9.  at System.Linq.Enumerable+<CreateSelectManyIterator>c__Iterator29`2[Mono.Cecil.TypeDefinition,Unity.IL2CPP.Metadata.Fields.FieldDefaultValue].MoveNext () [0x00000] in <filename unknown>:0
    10.  at System.Collections.Generic.List`1[Unity.IL2CPP.Metadata.Fields.FieldDefaultValue].AddEnumerable (IEnumerable`1 enumerable) [0x00000] in <filename unknown>:0
    11.  at System.Collections.Generic.List`1[Unity.IL2CPP.Metadata.Fields.FieldDefaultValue]..ctor (IEnumerable`1 collection) [0x00000] in <filename unknown>:0
    12.  at System.Linq.Enumerable.ToArray[FieldDefaultValue] (IEnumerable`1 source) [0x00000] in <filename unknown>:0
    13.  at Unity.IL2CPP.RegistrationWriter.WriteDefaultValueTable (Unity.IL2CPP.Metadata.MetadataCollector metadataCollector) [0x00000] in <filename unknown>:0
    14.  at Unity.IL2CPP.RegistrationWriter.WriteAssemblyDefinition (Unity.IL2CPP.AttributeCollection attributeCollection, Unity.IL2CPP.Metadata.MetadataCollector metadataCollector) [0x00000] in <filename unknown>:0
    15.  at Unity.IL2CPP.RegistrationWriter.Write (Unity.IL2CPP.AttributeCollection attributeCollection, Unity.IL2CPP.Metadata.MetadataCollector metadataCollector) [0x00000] in <filename unknown>:0
    16.  at Unity.IL2CPP.SourceWriter.WriteRegistrationFiles (Mono.Cecil.AssemblyDefinition assemblyDefinition, Mono.Cecil.TypeDefinition[] typeList, System.String fileName, Unity.IL2CPP.AttributeCollection attributeCollection, Unity.IL2CPP.Metadata.MetadataCollector metadataCollector) [0x00000] in <filename unknown>:0
    17.  at Unity.IL2CPP.SourceWriter.Write (Mono.Cecil.AssemblyDefinition assemblyDefinition, Unity.IL2CPP.GenericsCollection.InflatedCollection allGenerics, NiceIO.NPath outputDir, Mono.Cecil.TypeDefinition[] typeList, Unity.IL2CPP.StringLiterals.StringLiteralCollection stringLiteralCollection) [0x00000] in <filename unknown>:0
    18.  at Unity.IL2CPP.AssemblyConverter.Convert (Mono.Cecil.AssemblyDefinition assemblyDefinition, Unity.IL2CPP.StringLiterals.StringLiteralCollection stringLiteralCollection, Unity.IL2CPP.GenericsCollection.InflatedCollection allGenerics) [0x00000] in <filename unknown>:0
    19.  at Unity.IL2CPP.AssemblyConverter.Apply () [0x00000] in <filename unknown>:0
    20.  at Unity.IL2CPP.AssemblyConverter.ConvertAssemblies (System.String[] assemblies, NiceIO.NPath outputDir, System.Collections.Generic.List`1 additionalCpp) [0x00000] in <filename unknown>:0
    21. stderr:
    22.  
    23. Unhandled Exception: System.InvalidCastException: Cannot cast from source type to destination type.
    24.  at Unity.IL2CPP.Metadata.Fields.FieldDefaultValue.ConstantDataFor (Mono.Cecil.FieldDefinition field) [0x00000] in <filename unknown>:0
    25.  at Unity.IL2CPP.Metadata.Fields.FieldDefaultValue+<FromType>c__Iterator6.MoveNext () [0x00000] in <filename unknown>:0
    26.  at System.Linq.Enumerable+<CreateSelectManyIterator>c__Iterator29`2[Mono.Cecil.TypeDefinition,Unity.IL2CPP.Metadata.Fields.FieldDefaultValue].MoveNext () [0x00000] in <filename unknown>:0
    27.  at System.Collections.Generic.List`1[Unity.IL2CPP.Metadata.Fields.FieldDefaultValue].AddEnumerable (IEnumerable`1 enumerable) [0x00000] in <filename unknown>:0
    28.  at System.Collections.Generic.List`1[Unity.IL2CPP.Metadata.Fields.FieldDefaultValue]..ctor (IEnumerable`1 collection) [0x00000] in <filename unknown>:0
    29.  at System.Linq.Enumerable.ToArray[FieldDefaultValue] (IEnumerable`1 source) [0x00000] in <filename unknown>:0
    30.  at Unity.IL2CPP.RegistrationWriter.WriteDefaultValueTable (Unity.IL2CPP.Metadata.MetadataCollector metadataCollector) [0x00000] in <filename unknown>:0
    31.  at Unity.IL2CPP.RegistrationWriter.WriteAssemblyDefinition (Unity.IL2CPP.AttributeCollection attributeCollection, Unity.IL2CPP.Metadata.MetadataCollector metadataCollector) [0x00000] in <filename unknown>:0
    32.  at Unity.IL2CPP.RegistrationWriter.Write (Unity.IL2CPP.AttributeCollection attributeCollection, Unity.IL2CPP.Metadata.MetadataCollector metadataCollector) [0x00000] in <filename unknown>:0
    33.  at Unity.IL2CPP.SourceWriter.WriteRegistrationFiles (Mono.Cecil.AssemblyDefinition assemblyDefinition, Mono.Cecil.TypeDefinition[] typeList, System.String fileName, Unity.IL2CPP.AttributeCollection attributeCollection, Unity.IL2CPP.Metadata.MetadataCollector metadataCollector) [0x00000] in <filename unknown>:0
    34.  at Unity.IL2CPP.SourceWriter.Write (Mono.Cecil.AssemblyDefinition assemblyDefinition, Unity.IL2CPP.GenericsCollection.InflatedCollection allGenerics, NiceIO.NPath outputDir, Mono.Cecil.TypeDefinition[] typeList, Unity.IL2CPP.StringLiterals.StringLiteralCollection stringLiteralCollection) [0x00000] in <filename unknown>:0
    35.  at Unity.IL2CPP.AssemblyConverter.Convert (Mono.Cecil.AssemblyDefinition assemblyDefinition, Unity.IL2CPP.StringLiterals.StringLiteralCollection stringLiteralCollection, Unity.IL2CPP.GenericsCollection.InflatedCollection allGenerics) [0x00000] in <filename unknown>:0
    36.  at Unity.IL2CPP.AssemblyConverter.Apply () [0x00000] in <filename unknown>:0
    37.  at Unity.IL2CPP.AssemblyConverter.ConvertAssemblies (System.String[] assemblies, NiceIO.NPath outputDir, System.Collections.Generic.List`1 additionalCpp) [0x00000] in <filename unknown>:0
    38.  
    39. UnityEngine.Debug:LogError(Object)
    40. UnityEditorInternal.Runner:RunManagedProgram(String, String, String, CompilerOutputParserBase)
    41. UnityEditorInternal.IL2CPPBuilder:ConvertPlayerDlltoCpp(ICollection`1, String, String)
    42. UnityEditorInternal.IL2CPPBuilder:Run()
    43. UnityEditorInternal.IL2CPPUtils:RunIl2Cpp(String, String, IIl2CppPlatformProvider, Action`1, RuntimeClassRegistry)
    44. UnityEditor.HostView:OnGUI()
     
  7. danogles

    danogles

    Joined:
    Apr 15, 2013
    Posts:
    1
    Getting an exception in IL2CPP under 4.6.6 with the System.Net.HTTPListener.Stop method:

    NotSupportedException: /Users/builduser/buildslave/unity/build/Tools/il2cpp/il2cpp/libil2cpp/icalls/mscorlib/System.Threading/Thread.cpp(366) : Unsupported internal call for IL2CPP:Thread::Abort_internal - "Thread abortion is currently not implemented on IL2CPP; it is recommended to use safer mechanisms to terminate threads."

    Screenshot 2015-06-09 14.51.34.png

    I realize Thread.Abort is not supported, but there does not seem to be a workaround for this.

    Unrelated: Are you aware of the odd stack trace dumps being reported in exceptions and log statements? 9/10 it seems the stack trace is nonsense.
     
  8. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,779
    @danogles

    Hmm, we were not aware that System.Net.HTTPListener.Stop could call Thread.Abort. We might need to support it after all. Can you send us a bug report with a project to reproduce this?

    For the stack trace issue, a fix is coming :). We merged it last week, and I've just put the fix in our release branches today. I'll have more to say about it in a post when it is released (hopefully this week).
     
  9. jinke

    jinke

    Joined:
    Dec 1, 2014
    Posts:
    3
    Just wanted to report that we're seeing an order of ~40MB memory usage reduction (specifically in System.ExecutableAndDlls, both in Unity's profiler and Xcode's) thanks to upgrading to the latest patch release 4.6.6p1 :)
     
    joncham and JJC1138 like this.
  10. charmandermon

    charmandermon

    Joined:
    Dec 4, 2011
    Posts:
    352
    Hey Josh quick question, does the new unity 5.1 contain the patch rollup through 5.0.2p4? I didnt see anything in the release notes about il2cpp.

    Thanks man
     
  11. andymads

    andymads

    Joined:
    Jun 16, 2011
    Posts:
    1,614
    Just wanted to add that this issue also occurs in 4.6.6p1.
     
  12. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,779
    @jinke

    That is good to hear, thanks for letting us know.
     
  13. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,779
    @charmandermon

    The 5.1 release is a bit behind the latest 4.6 and 5.0 patch releases for IL2CPP fixes. Please use 5.1.0p1, which catches up to 5.0.2p4 for IL2CPP fixes, when it is out at the end of this week. Thanks.
     
  14. mstfr

    mstfr

    Joined:
    Jul 8, 2014
    Posts:
    3
    @JoshPeterson

    Exactly how to fix it?
     
  15. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,779
    @mstfr

    I don't believe there is a need to fix these warnings. They are annoying for sure, but they are from generated C++ code, so there is not much you can do to remove them. We will likely look at removing them in the future during code generation. However, since they don't cause any known problems now, removing them is low priority for us.
     
  16. clivsey

    clivsey

    Joined:
    Mar 4, 2015
    Posts:
    2
    We are seeing a new issue in the 4.6.6p1 version that does not occur in 4.6.6. When trying to build with IL2CPP we get the following error with a third party DLL:

    IL2CPP error for type 'Matrix.XPathFilter' in assembly '/il2cpp_playground/Temp/StagingArea/Data/Managed/Matrix.dll'
    Additional information: Build a development build for more information. Cannot cast from source type to destination type.

    A development build reveals:

    Unhandled Exception: System.InvalidCastException: Cannot cast from source type to destination type.
    at Unity.IL2CPP.Metadata.Fields.FieldDefaultValue.ConstantDataFor (Mono.Cecil.FieldDefinition field) [0x00000] in <filename unknown>:0

    I have submitted a bug report with more details and full strack trace, number is 703294
     
    Last edited: Jun 10, 2015
  17. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,779
    @clivsey

    Thanks for reporting this, we will investigate it.
     
    clivsey likes this.
  18. mhalttu

    mhalttu

    Joined:
    Mar 13, 2013
    Posts:
    30
    @JoshPeterson The size of the xcodeproj file generated by Unity for our project has increased from 200 kB to a whopping 5.4 MB in Unity 4.6.6.
     
  19. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    959
    Considering how many .cpp and .h files it includes, that is hardly surprising.
     
  20. mhalttu

    mhalttu

    Joined:
    Mar 13, 2013
    Posts:
    30
    To be clear, I'm talking about a difference between 4.6.5 and 4.6.6p1. Why does the new version generate that many more .cpp and .h files? Already the previous build had plenty.

    The problem with a 5 MB project file is that the post processors are not built for so massive files. Our build time increased from 15 minutes to 30 minutes, mostly spent in post processors. Compare that to 3 minutes it used to be with a 32 bit build.
     
  21. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,779
    @mhalttu

    Something seems off there. The il2cpp.exe utility might be generating a few more .cpp and .h files, but it should not be generating that many more files. I wonder if it is converting more IL code than it was before. We've not made any changes to the number of C++ files generated. Is it possible to dig into the differences between the two Xcode projects? Are there new files in the 4.6.6p1 project? Or are the existing files just larger? Thanks.
     
  22. floky

    floky

    Joined:
    Oct 6, 2010
    Posts:
    273
    @JoshPeterson Just found and reported a bug in Unity 4.6.6p1 when building with IL2CPP. I think it happens in older versions of Unity as well.
    The method "Directory.GetFiles(strSearchPath, strSearchPattern)" doesn't work in some usage situation on IL2CPP builds. It works ok on Mono builds.

    More specifically, if you use a more complex search pattern for the 2nd parameter for example, "partialFileName_*.ext", it will always return zero results even if you have such files in the specified path. On Mono builds it works ok.

    If you call it using the search pattern "*.ext" it will work ok and return a list of all the files that have the extension "ext".

    The case number is: 703908.
     
  23. Langano

    Langano

    Joined:
    Dec 18, 2012
    Posts:
    10
    Hey,

    I think i have found a bug with IL2CPP.
    We are using the json.net port for unity (version 4.6.6)
    I might add that this was not present in the earlier unity version we used (4.6.4), so it could be a regression.

    The code that is throwing the error looks like this:
    uint8_t L_3 = (( uint8_t (*) (Object_t * /* static, unused */, JToken_t225 *, const MethodInfo*))IL2CPP_RGCTX_METHOD_INFO(method->rgctx_data, 0)->method)(NULL /*static, unused*/, (JToken_t225 *)L_2, /*hidden argument*/IL2CPP_RGCTX_METHOD_INFO(method->rgctx_data, 0));

    (This throws a EXC_BAD_ACCESS in runtime when using the jToken.Value<T>(key))

    It appears there is no NULL checking or handling here.
    Let me know if i have repeated a known bug or if this is new.

    Cheers
     
  24. Sebrofjr

    Sebrofjr

    Joined:
    Oct 1, 2014
    Posts:
    24
    We are now into 64bit and are able to build properly since 4.6.5p2. We are currently on 4.6.6p1 and running into a couple of issues that have been occurring after 4.6.2p3. Our pre-June release was using 4.6.2p3 as we were still able to build to 32 bit for iOS submission. Now with the 64 bit requirement, we need to be on these later builds that have the following issues:

    The main one is the frame rate increase that has been pending since April. This is really slowing down older devices and particularly devices still running iOS 7.

    Forum Post:
    http://forum.unity3d.com/threads/dr...e-latest-version-of-unity-4-6-4-6-4p2.318742/

    Bug# 696334
    Bug# 689600
    Bug# 701881

    The next one is slightly minor but also started occurring at the same time. It has to do with the caret position on input text fields in UI.

    Text Input Caret Issue
    Forum post:
    http://forum.unity3d.com/threads/inputfield-caret-position-changes-with-font-size-4-6-4p3.322030/

    Bug# 693093
     
  25. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,779
    @floky

    Thanks, we will investigate this.
     
  26. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,779
    @Langano

    I don't believe that we have a report on a bug like this. Could you submit a bug report with a project to reproduce it? Thanks.
     
  27. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,779
    @Eric Diepeveen

    This looks like a stack overflow in the regular expression code. Do you know what part of your script code is calling into this code? It might help to see how the regular expression code is being used here.
     
  28. Langano

    Langano

    Joined:
    Dec 18, 2012
    Posts:
    10
    Yes, i will put a project together.
    I can also chime in with more info on this.
    The problem appears to be when casting to generic type of bool.

    Could this be an assumption of byte length 1, i think bools are 4 bytes in .net.
    Just an idea.

    The creator of the json.net library (talked to him) seems to think something similar as well.
    The workaround was to not use bools but strings and then recast the return string value to bool.

    Cheers
     
  29. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,779
    @Sebrofjr

    Unfortunately, I'm not sure there is too much we can do from the IL2CPP side about these issues. It looks like the bugs are all in our system, they just need to get some investigation. It may help you to respond to the bugs via email and mention that these issues are blocking you from getting a new IL2CPP version, and therefore shipping iOS for 64-bit.
     
  30. Eric-Diepeveen

    Eric-Diepeveen

    Joined:
    Aug 19, 2013
    Posts:
    11
    Found out it has to do with either the Facebook or Parse plugin. Always fun :p
     
  31. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,779
    @Eric Diepeveen

    If the plugin which causes the problem works with the Mono scripting backend then the problem is likely a bug we should investigate on the Unity side. If so, please submit a bug report. Thanks!
     
  32. spl0k

    spl0k

    Joined:
    Jun 12, 2015
    Posts:
    8
    I encountered an issue involving weird callstacks and serialization errors such as this one:
    This wasn't happening when using Mono.

    I found that if you have two different components in different assemblies sharing the same name (ie one MyScript.cs in a "standard" folder and one MyScript.cs in a Plugins folder), the player could get confused and use the code from the wrong assembly.

    I submitted a bug with an example project: id 704197.
     
  33. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,779
    @spl0k

    Thanks for reporting this bug! We will investigate it.
     
  34. achooley

    achooley

    Joined:
    Sep 6, 2013
    Posts:
    17
    Hi. I know this is 4.6 thread but....
    Seems we have problem with IL2CPP. (Unity5.0.3p1).The same project is behaving differently IL2CPP and Mono 2x
    After several reload the main game field we receive "Received memory warning.WARNING -> applicationDidReceiveMemoryWarning()". On each reload, we increase the memory usage ~30MB. When the memory usage more then >302MB application stop.
    We also have mono 2x build. And it is working properly. Memory usage after 5 reload : ~240 MB

    I added a screenshots. On the first two (mono build) : mono1- after the start, mono2 -after 4 reload
    On the second (IL2CPP) x64_1- after the start, x64_2 -after 4 reload

    What we need to do to properly submit issue?
     

    Attached Files:

    Last edited: Jun 12, 2015
  35. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,779
    @achooley

    If you would like to submit a debug report, please use the Help > Report a Bug option in the editor. In this case, you will need to include the full project in order for us to have a look at it.

    You may also want to consider using Instruments to profile this, as we've seen some unreliable information from Xcode in a few cases.
     
  36. ortin

    ortin

    Joined:
    Jan 13, 2013
    Posts:
    221
    @JoshPeterson
    I assume the fact that the app is killed by iOS (low memory warning) with IL2CPP and lives forever with mono isn't that unreliable.
     
  37. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,779
    @ortin

    Yes, sorry. I did not intend to imply that there is not actually a problem. I was just saying that we might gain more insight about the cause of the problem using Instruments.
     
  38. ortin

    ortin

    Joined:
    Jan 13, 2013
    Posts:
    221
    Well, we (work at the same company as achooley) just cannot resumbit the app to Apple, so sorry if my reaction was a bit harsh as well :).

    So, we'll submit full project with bug report (not sure if it passes QA though) and try to get more specific info using Instruments. Anything we should look at first place, coz never used Instruments as always worked with Unity Profiler?
     
  39. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,779
    @ortin

    No worries, I understand this can be frustrating. :)

    If the full project is too large to make it through our bug reporter, we can obtain it in a different way, maybe via Dropbox or something similar (we have a blind FTP for large projects as well). Just mention in the bug report that you cannot get the full project to upload. Also, let me know the bug report number when you get it.

    Unfortunately I can't say what to look for in Instruments specifically without seeing the project. You should be able to see what is causing these large jumps in memory though. This kind of memory usage is not something we've seen yet, so I hope that the cause will jump out. Now whether there is anything you can do to work around the problem - I'm not sure about that. But maybe Instruments will give you some extra insight that will help.

    Meanwhile, we'll investigate from our end, as this is something we've not seen yet.
     
  40. DodoGG

    DodoGG

    Joined:
    Jun 15, 2015
    Posts:
    2
    About the conversion between structure and byte stream, we use Marshal.PtrToStructure/Marshal.StructureToPtr to do the trick in our project.
    For a complex structure which contains array, it doesn’t work on IOS, because of JIT/AOT or whatever.

    For structure like this:
    Code (CSharp):
    1. [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode, Pack = 1)]
    2. public struct Login_struct
    3. {
    4.     [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
    5.     public char[] account;
    6.     [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
    7.     public char[] password;
    8.     [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
    9.     public char[] email;
    10. }
    Marshal tool cannot work properly, it can get the proper size of the structure, but cannot convert between intptr and structure.

    Luckily, we can define the structure to be continuous in memory, so we use a memcpy plugin to dump structure or byte stream from memory and do the conversion.
    ——————————————————————
    This method helps us to solve the issue about serialize/deserialize of structure(contains array)on IOS, and works properly under Mono.

    But il2cpp just ruins it all. After il2cpp, the arrays in structure are replaced by 3 pointers. From Xcode I can tell those 3 pointers are not continuous in memory, which means the plugin we used to use cannot work properly any longer. The size of the structure even changes to 8*3=24(64bit), but not (12+32+32)*2(Unicode char) which we defined in C#.

    I’m afraid there is a bug that il2cpp doesn’t fully inherit the information from C# code, and it has a big influence on our project. I have no choice but counting on you guys now, please help me.

    I can also provide a test demo if necessary.

    Thanks a lot
     
    Last edited: Jun 15, 2015
  41. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,779
    @DodoGG

    Please submit a bug report along with a test project, as you mentioned. That will allow us to correct this issue. Please let me know the bug number when it is submitted. Thanks!
     
  42. DodoGG

    DodoGG

    Joined:
    Jun 15, 2015
    Posts:
    2
    Sure, Case 704696. Please take a look.
    @JoshPeterson
     
  43. mhalttu

    mhalttu

    Joined:
    Mar 13, 2013
    Posts:
    30
    @JoshPeterson

    I just checked and the new file is 32 times larger. I think there are some extra files there but I think the biggest problem is that the whole format of the file is different. It's now XML! Is there some setting I can change to fix that?

    What email address could I use to send the project files to you guys for inspection?
     
  44. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,779
    @DodoGG

    Thanks, we will investigate this.
     
  45. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,779
    @mhalttu

    Which XML file are you referring to? Something still seems off here. You can submit a bug report using Help > Report a Bug in the Unity editor. That is the best way to report this issue to us.
     
  46. pikkugergely

    pikkugergely

    Joined:
    Jun 15, 2015
    Posts:
    6
    Hi,

    I found an issue with respect to the treatment of NaNs when compiling with IL2CPP (at least for iOS): when comparing a NaN to another number, the result should be universally false, but it actually yields true instead. This leads to all kinds of undesired behaviour in various Mathf and Vector routines, and makes it really difficult to track down bugs due to the fact that the editor and the device behave differently.

    Here's a simple example to reproduce the issue, just compile it for iOS:

    Code (CSharp):
    1. Test code:
    2.  
    3. Debug.Log("===== Start NaN handling test =====");
    4. var nan2 = new Vector2(float.NaN, float.NaN);
    5. Debug.Log("Mathf.Clamp01(NaN) = " + Mathf.Clamp01(float.NaN));
    6. Debug.Log("Mathf.Sign(NaN) = " + Mathf.Sign(float.NaN));
    7. Debug.Log("Mathf.Sqrt(NaN) = " + Mathf.Sqrt(float.NaN));
    8. Debug.Log("Mathf.Lerp(NaN, 0, 0) = " + Mathf.Lerp(float.NaN, 0f, 0f));
    9. Debug.Log("Mathf.Lerp(NaN, 0, 0.5) = " + Mathf.Lerp(float.NaN, 0f, 0.5f));
    10. Debug.Log("Mathf.Lerp(NaN, 0, 1) = " + Mathf.Lerp(float.NaN, 0f, 1f));
    11. Debug.Log("Mathf.Lerp(NaN, 0, NaN) = " + Mathf.Lerp(float.NaN, 0f, float.NaN));
    12. Debug.Log("Mathf.Lerp(1, 0, NaN) = " + Mathf.Lerp(1f, 0f, float.NaN));
    13. if (float.NaN > 10)
    14. {
    15.     Debug.Log("NaN > 10: IMPOSSIBLE!");
    16. }
    17. if (float.NaN < 10)
    18. {
    19.     Debug.Log("NaN < 10: IMPOSSIBLE!");
    20. }
    21. var newNaN = Mathf.Sqrt(-1f);
    22. Debug.Log("newNaN = " + newNaN);
    23. if (newNaN > 10)
    24. {
    25.     Debug.Log("newNaN > 10: IMPOSSIBLE!");
    26. }
    27. if (newNaN < 10)
    28. {
    29.     Debug.Log("newNaN < 10: IMPOSSIBLE!");
    30. }
    31. Debug.Log("nan2.magnitude = " + nan2.magnitude);
    32. Debug.Log("nan2.normalized = " + nan2.normalized);
    33. Debug.Log("Vector2.Distance(nan2, zero) = " + Vector2.Distance(nan2, Vector2.zero));
    34. Debug.Log("Vector2.Lerp(nan2, zero, 0) = " + Vector2.Lerp(nan2, Vector2.zero, 0f));
    35. Debug.Log("Vector2.Lerp(nan2, zero, 0.5) = " + Vector2.Lerp(nan2, Vector2.zero, 0.5f));
    36. Debug.Log("Vector2.Lerp(nan2, zero, 1) = " + Vector2.Lerp(nan2, Vector2.zero, 1f));
    37. Debug.Log("Vector2.Lerp(nan2, zero, NaN) = " + Vector2.Lerp(nan2, Vector2.zero, float.NaN));
    38. Debug.Log("Vector2.Lerp(one, zero, NaN) = " + Vector2.Lerp(Vector2.one, Vector2.zero, float.NaN));
    39. Debug.Log("===== End NaN handling test =====");
    40.  
    41. Editor and 32-bit Mono AOT output:
    42.  
    43. ===== Start NaN handling test =====
    44. Mathf.Clamp01(NaN) = NaN
    45. Mathf.Sign(NaN) = -1
    46. Mathf.Sqrt(NaN) = NaN
    47. Mathf.Lerp(NaN, 0, 0) = NaN
    48. Mathf.Lerp(NaN, 0, 0.5) = NaN
    49. Mathf.Lerp(NaN, 0, 1) = NaN
    50. Mathf.Lerp(NaN, 0, NaN) = NaN
    51. Mathf.Lerp(1, 0, NaN) = NaN
    52. newNaN = NaN
    53. nan2.magnitude = NaN
    54. nan2.normalized = (0.0, 0.0)
    55. Vector2.Distance(nan2, zero) = NaN
    56. Vector2.Lerp(nan2, zero, 0) = (NaN, NaN)
    57. Vector2.Lerp(nan2, zero, 0.5) = (NaN, NaN)
    58. Vector2.Lerp(nan2, zero, 1) = (NaN, NaN)
    59. Vector2.Lerp(nan2, zero, NaN) = (NaN, NaN)
    60. Vector2.Lerp(one, zero, NaN) = (NaN, NaN)
    61. ===== End NaN handling test =====
    62.  
    63. Device output (both 32 and 64-bit IL2CPP):
    64.  
    65. ===== Start NaN handling test =====
    66. Mathf.Clamp01(NaN) = 0
    67. Mathf.Sign(NaN) = 1
    68. Mathf.Sqrt(NaN) = NaN
    69. Mathf.Lerp(NaN, 0, 0) = NaN
    70. Mathf.Lerp(NaN, 0, 0.5) = NaN
    71. Mathf.Lerp(NaN, 0, 1) = NaN
    72. Mathf.Lerp(NaN, 0, NaN) = NaN
    73. Mathf.Lerp(1, 0, NaN) = 1
    74. newNaN = NaN
    75. newNaN > 10: IMPOSSIBLE!
    76. newNaN < 10: IMPOSSIBLE!
    77. nan2.magnitude = NaN
    78. nan2.normalized = (NaN, NaN)
    79. Vector2.Distance(nan2, zero) = NaN
    80. Vector2.Lerp(nan2, zero, 0) = (NaN, NaN)
    81. Vector2.Lerp(nan2, zero, 0.5) = (NaN, NaN)
    82. Vector2.Lerp(nan2, zero, 1) = (NaN, NaN)
    83. Vector2.Lerp(nan2, zero, NaN) = (NaN, NaN)
    84. Vector2.Lerp(one, zero, NaN) = (1.0, 1.0)
    85. ===== End NaN handling test =====
    Bug report number: 704709 (note: I meant to attach the above snippet to the ticket, but it didn't work for some reason...)
     
  47. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,779
    @pikkugergely

    Thanks for reporting this, we will investigate it. It looks like the code snippet did get attached to the bug report, so I think that we have enough information to reproduce this issue.
     
  48. mhalttu

    mhalttu

    Joined:
    Mar 13, 2013
    Posts:
    30
    @JoshPeterson I'm referring to the project.pbxproj file generated by Unity. Here's how it looks on Unity 4.6.5:

    Code (csharp):
    1.  
    2. // !$*UTF8*$!
    3. {
    4. archiveVersion = 1;
    5. classes = {
    6. };
    7. objectVersion = 46;
    8. objects = {
    9.  
    10. /* Begin PBXBuildFile section */
    11. 007D4250BCF5209BA22051E8 /* Bulk_Assembly-CSharpMetadata_7.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0E3C4924AAFA1AED26F72B08 /* Bulk_Assembly-CSharpMetadata_7.cpp */; };
    12. 00D2406FBB66D2B3070B2BB5 /* Bulk_Assembly-CSharpMetadata_11.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91D44D66A7D8648156EB791A /* Bulk_Assembly-CSharpMetadata_11.cpp */; };
    13.  
    And here's how it looks on Unity 4.6.6:

    Code (csharp):
    1.  
    2. <?xml version="1.0" encoding="UTF-8"?>
    3. <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    4. <plist version="1.0">
    5. <dict>
    6.     <key>archiveVersion</key>
    7.     <string>1</string>
    8.     <key>classes</key>
    9.     <dict/>
    10.     <key>objectVersion</key>
    11.     <string>46</string>
    12.     <key>objects</key>
    13.     <dict>
    14.         <key>000048DC9EABA08042519560</key>
    15.         <dict>
    16.             <key>isa</key>
    17.             <string>PBXFileReference</string>
    18.             <key>lastKnownFileType</key>
    19.             <string>sourcecode.c.h</string>
    20.             <key>name</key>
    21.             <string>TcpClientImplementation_Org_BouncyCastle_Asn1_X9_X962NamedCuMethodDeclarations.h</string>
    22.             <key>path</key>
    23.             <string>Classes/Native/TcpClientImplementation_Org_BouncyCastle_Asn1_X9_X962NamedCuMethodDeclarations.h</string>
    24.             <key>sourceTree</key>
    25.             <string>SOURCE_ROOT</string>
    26.         </dict>
    27.  
    I believe the XML is some old format, which shouldn't be used. Please confirm you are seeing the same behaviour.
     
  49. povilas

    povilas

    Unity Technologies

    Joined:
    Jan 28, 2014
    Posts:
    427
    Hello, we don't see this behavior. It's likely that you have some plugin with a postprocess step which is interfering.
     
  50. mhalttu

    mhalttu

    Joined:
    Mar 13, 2013
    Posts:
    30
    @povilas Really interesting. I guess I have to believe you but how could this behaviour have changed between 4.6.5 and 4.6.6? Only Unity version was changed, the sources are 100% identical.

    Also please confirm that your project.pbxproj is NOT xml in 4.6.6.