Warning of System.OutOfMemoryException while building an App - xamarin.android

I'm new to Xamarin. While Building my project, I came across this Warning. I tried to look for its solutions, but none of them resolved this issue.
Severity Code Description Project File Line Source Suppression State
Warning Exception of type 'System.OutOfMemoryException' was thrown.
at Microsoft.Cci.Pdb.MsfDirectory..ctor(PdbReader reader, PdbFileHeader head, BitAccess bits)
at Microsoft.Cci.Pdb.PdbFile.LoadFunctions(Stream read, BitAccess bits, Boolean readAllStrings)
at Microsoft.Cci.Pdb.PdbFile.LoadFunctions(Stream read, Boolean readAllStrings)
at Pdb2Mdb.Converter.Convert(String filename)
at Xamarin.Android.Tasks.ConvertDebuggingFiles.Execute()

Thats is related to RAM being not enough .
You can try increasing virtual memory .
If you are working on MAC - you need 8 gb ram that should do .
on Windows when we were getting that problem we had to increase that to 16 gb to get rid of it .( vs and android studio both were there though) .

Related

JIT issues with IOS Xamarin SQLite

So I have some classes that I have been storing in a local SQLite DB in a Xamarin Forms application. Works fine on UWP, Android, and iOS except for Release on a physical device. Keep getting JIT warnings. I've tried removing linking various ways to ensure it's getting compiled but no dice. The root of the issue seems to be within the usage of SQLite-Net-pcl nuget library. Does anyone have advice on how to ensure that code has been AOT compiled? My abstract class, maybe too abstract? Not sure.
public abstract class SqlRepositoryLite<T, TInterface> : IRepositoryLite<TInterface> where T : class, IDto, TInterface, new()
{
public IEnumerable<TInterface> Items => Connection.Table<T>();
Crash reports:
SIGABRT: Attempting to JIT compile method '(wrapper delegate-invoke) void <Module>:invoke_callvirt_void_CharacterItem_int (PFAssistant.Core.Services.CharacterItem,int)' while running in aot-only mode. See https://learn.microsoft.com/xamarin/ios/internals/limitations for more information.
Stacktrace:
FastColumnSetter+<>c__DisplayClass2_0`2[ObjectType,ColumnMemberType].<CreateTypedSetterDelegate>b__0 (System.Object o, SQLitePCL.sqlite3_stmt stmt, System.Int32 i)
SQLiteCommand+<ExecuteDeferredQuery>d__12`1[T].MoveNext ()
List`1[T].AddEnumerable (System.Collections.Generic.IEnumerable`1[T] enumerable)
System.Collections.Generic.List`1[T]..ctor (System.Collections.Generic.IEnumerable`1[T] collection) <0x1052cce30 + 0x0021f> in <25bf495f7d6b4944aa395b3ab5293479#0dcf7231fb8229d159bd9a1419156fe3>:0
Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source)
SQLiteCommand.ExecuteQuery[T] ()
Update: Would seem updating Sqlite-net-pcl to v1.8.116 was a major part of my issue, had issues with 1.6.292 as well. 1.7.335 worked perfectly.
I found the same to be the case today. Downgrading to 1.7.335 is the solution.

stm32f070rbt6 Stack pointer invalid address problem

I have currently changed to a new microcontroller, STM32F070RBT6, I have used the STM32CubeMx to set up the microcontroller, i currently have no code just HAL initialisation code, when i debug it comes up with error message saying " The stack pointer for stack 'CSTACK' (currently 0x20000E38) is outside the stack range (0x20000110 to 0x20000510)"
I have tried all today to find the error, thats why i created a new stm32cube project with only initialisation code to see if it was an error on my part or HALs, does anyone have any idea what is causing this error? I havn't provided code as the project only contains the startup file etc, I am also using IAR as the IDE

Metal functions failing to compile with Xcode 8

Since moving to Xcode 8 and iOS10, my metal based app fails to run at all. On launch I get the error: "Compiler failed with XPC_ERROR_CONNECTION_INTERRUPTED"
This appears two to three times in the console before crashing due to a MTLComputePipelineState not being successfully created and throwing an error when calling the MTLDevice function makeComputePipelineState(function:). The only changes I have made to the project is to update to Swift 3.0, but the console seems to imply a compiler error, which due to the crash I'm assuming is down to some metal code not compiling properly.
Any help would be appreciated, this is ageing me prematurely.
UPDATE:
I've located the line causing the trouble in the .metal file:
int gi1 = permMod12[ii+i1+perm[jj+j1+perm[kk+k1]]];
permMod12 is a static constant array declared as:
static constant int permMod12 [512] = {7,4,5,7...}
perm is similarly static and constant:
static constant int perm [512] = {151,160...}
The variables ii, i1, jj, j1, kk and k1 are all integers calculated in the same kernel.
The kernel is quite large so I'll post a link to the GitHub location. It's the functions called simplex3D and simplex4D that are causing the issue. These are very similar so only focus on one of them, they are carbon copies but 4D has another stretch of variables running (ll, l1, l etc).
The issue certainly seems to be with looking up these arrays with calculated variables as when I change the variables to simple literals there is no error.
The kernel needs to be executed in order to get the error to occur.
Any help with this new info would be great.
I also encountered the same error: "Compiler failed with XPC_ERROR_CONNECTION_INTERRUPTED". The issue was resolved. It stemmed from attempted use of 'threadgroup bool' type variables. Refactoring the code to use 'threadgroup short' variables in place of the boolean resolved the error. (Could not find in the Metal Version 2 specification if bool type is or is not a valid threadgroup type.)
I've encountered this situation, and it seems that there is no unique solution to solve this problem. In my case, the problem was occurred when a texture that uses a normalized coordinate sampler also uses read() function. When I switch read() function to sample() this weird error was removed. I hope your problem were solved already.

Lua: Read Unsigned DWORD not working in Bizhawk Emulator

When I run my code I get an error on this line:
personality = memory.readdwordunsigned(0x02024744)
This is the error message I am given by the console:
LuaInterface.LuaScriptException: [string "main"]:26: attempt to call field 'readdwordunsigned' (a nil value)
I have been doing some testing and researching around this for a while and I cannot get it to work despite this concept being used on several other projects such as this: https://projectpokemon.org/forums/showthread.php?16681-Gen-3-Lua-Scripts
Some other information:
1. I am running the lua script on the BizHawk emulator.
2. if I change the line to memory.readbyte() I receive a different message, which leads me to believe that the console does not recognise memory.readdwordunsigned() as a funciton.
3. The script is in the same folder as the executable file for the emulator.
Thank you in advance for any help
Turns out that support for memory.readdwordunsigned() is no longer supported in the BizHawk Emulator. After extensive research and help from a comment posted on my question I have managed to find a working alternative:
memory.usememorydomain("System Bus")
personality=memory.read_u32_le(0x02024744)
For anyone else who finds this answer useful, please note that a dword is unsigned and 4 bytes in size, hence the use of u32, because a dword is 32bits and unsigned. If you wanted to use a signed byte, for example, you would use s8 instead. le means little endien, be can be used instead for big endien.
It is important to state the memory domain before attempting to read from memory because the memory domain I was using (IWRAM) as well as all other memory domains except for the system bus would produce this error due to the size of the memory address.

Windriver VxWorks Simulator Self modifying code

Good morning.
I have a program that is Self-Modifying-Code.
Really, it build the binaries, which then are changed by ELFPatch and changes some function's prologues.
I am working with Windriver WorkBench 3.3 & VxWorks 6.9 Update3.
I created a standard simulator (PENTIUM),
when i run my code on the simulator:
void replace_prolog(void* func_ptr) {
char* p = (char*)func_ptr;
for (int i=0; i < PROLOGUE_SIZE; ++i)
p[i]=m_prologue[i]; // << prologue is a member array.
...
}
Let's call the Real Prologue : Original Prologue;
The Changed Prologue : Changed Prologue;
The One that is placed at Run-Time : Replacement Prologue;
I get an Exception (signal 11 - Segmentation Fault).
!! I realized it is VxWorks's .text Segment Protection.
So, I created a SimPC based VIP to be my simulator BSP, and excluded INCLUDE_PROTECT_TEXT (and all it's relevant kernel components)
and run the simulator:
Now, there is no exception!
Facts
Looking at Memory Browser I see the Changed Prologue Bytes (memory didn't change)!
Printing the buffer to console, prints the Replacement Prologue Bytes values! (Weird)
looking at assembly view (Mega Weird): shows the Changed Prologue Hex values but the Original Prologue asm commands (push bp;...) even though the byte value does not match them.
My Questions
Anyone had any experience with modifying .text segment?
Anyone encountered memory that would not change (without an exception/signal) on simulator, which is not a memory mapped port/volatile ?
Long Shot Assumption
I have an assumption it is about caching, hinting that vxWorks know this region shouldn't change, so it doesn't write_through, but don't know how i can check it...
EDIT 2: tried setting my pointers to be volatile => same behavior!
Please Help.
This may not be the answer but since you are seeing expected output, it confirms that .text section is changed. Only explanation I can think of is if you are using host tools to look at the .text memory then there is a possibility that information may be read from host.
Did you typed commands on target to look at the memory location?
Forgot about the question: but still have an answer.
there is an issue with the Host_Tools which does not show the changes to .text section.
while on the target, the bytes actually changed.
the function didn't work because my transformation was ruining dynamic linking.
my function code, had a call to function with a constant string "Whatever"
when i transformed the function code, i unintentionally, changed the reference of a relocation pointer which at loading time got a bad absolute PTR.
Lucky me, it pointed to a 0x00 buffer, and therefore printed an empty string without crashing.
Suggested Solutions:
Do not touch the relocated Pointers both when altering the Executable and altering at Run-time.
Create a static self-contained executable with absolute footprint => no dynamic relocation occurs that way.
alter dl() to transform the altered reloacted pointers back to their expected relocated.
alter dl() to infer from the altered relocated pointers the expected altered absolute pointer, so the transformation will create absolute pointer.
Note: I Choose #2 because it is the simplest, and because in my system, I do not need shared objects anyway.

Resources