(XCode 7 + iOS 9 + iPhone 4s/iPhone5 only) issue: "malloc: *** mach_vm_map(size=1048576) failed (error code=3)" - malloc

I know the issue is related to memory allocations, but I get it in only iOS 9, XCode 7. In XCode 6.4, iOS 8.4, it works just perfect, no issue at all at any ways. In iOS 9, XCode 7, it just crashes very frequently giving this error.
malloc: *** mach_vm_map(size=1048576) failed (error code=3)
*** error: can't allocate region securely
*** set a breakpoint in malloc_error_break to debug
Any suggestions? I am working on memory issues, but I wonder if there were too many memory issues, then why did it work in iOS 8.4 and not in iOS 9?
Also, I get all my UI whited out! Like navigation bar has no title, custom tabbar(RDVTabBar) is not visible, however, other view controller is there (it responds to the touch events, you can tap that area and the button positioned in that area acts!).
P.S. I don't get memory warning ever, neither applicationWillTerminate: method is being called!
Update: I found that this issue occurs in iPhone 5 and 4s only! (Non-64bit devices!)
Update 2: When the crash happens, I try to print one of the object and to print it, I again get the same error in debug mode:
malloc: *** mach_vm_map(size=1048576) failed (error code=3)
*** error: can't allocate region securely
*** set a breakpoint in malloc_error_break to debug.
------------------ Update ------------------
Well, I found something here: I inspected my app in Instruments and detected that it occupies about 200mb of memory in iOS 8.4, and surprisingly iOS 9.* occupies 1.5 GB of the memory!!! This is something I don't understand! One app takes 200 mb of memory in iOS 8.4 and the same app takes over 1.5GB of memory on iOS 9! Not understandable at all! Any Idea?

Well, I guess I have finally found the issue: Its definitely memory issue, but I had to search where. I found that I am using two third party labels namely: CXAHyperlinkLabel and STTweetLabel. When I removed those, my app just work fine!! The issue has been resolved but still I am confused why it did work (and still works) great in iOS 8.4 and eats up more than 1.5 GB of memory in iOS 9.0 and above!! If it has some issues with memory (I found some and fixed already, still), why it did work with iOS 8.*.
So, my advice to any fellow who are having such issues, I recommend using UITextView for links (I did it and its nice replacement).

I've just experienced the exact issue as you (xcode7, on iPad 2, iOS 8.4).
<Error>: myApp(524,0x3cfda9dc) malloc: *** mach_vm_map(size=4060311552) failed (error code=3)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
So, I decide to ran on debug mode, and the app crash in the most unexpected place:
[self.delegate discountPopupDoneClickWithDiscount:self.discount
type:self.discountType
federalTaxEnable:self.federalTaxEnable
federalTax:self.federalTax
customTax:self.customTax];
Then I tried to find out what happened here, type po self.discount, turn out self.discount (it's a property with NSDecimalNumber type) return a very unsual value, like <å: 0xba123adr>. Strange, right? Also, when I try po [self discount], it yield NSDecimalNumber [_NSKeyedCoderOldStyleArray initialize]: Unrecognized selector send to instance. Pretty much clueless what to do here.
Solution:
I update the discount property from this:
#property (nonatomic, assign) NSDecimalNumber *discount;
to this:
#property (nonatomic, strong) NSDecimalNumber *discount;
And then everything's fine. Of course this isn't an exact answer/solution to your question, but this may help/give you a clue on what to do, somehow.

So strange. I had a very similar issue, where the app would continually increase memory consumption until eventually it would crash, but ONLY on iOS7 and iOS8. Sure enough, no issues with iOS9 and up.
Found out that a simple setting of [UILabel setText:text] for A LOT of collectionViewCells was the cause. WTF? They were weak, nonatomic. Why?
Ran the app in Instruments : Allocations. Before Instruments eventually crashed, I was able to isolate the memory consumption to __NSStringDrawingEngine, +[NSParagraphStyle _defaultWritingDirection] [UIFont fontWithName] or something to that nature.
Anyway, turns out the issue is that I was using the Text Styles types (Eg, Title 1, Title 2, Body, Caption, etc). Seemed logical to use at the time. But, I switched those over to System fonts, and no more memory issue and no more freezing.
So strange.

did you use the NSZombieObject enable,it will not release the zombie object,and may cause this crash.i hope it will help you

Related

Memory Monitor using ':C XXXX' in RDi not Showing Variable Value

When monitoring memory using the :C XXXX option, the memory values do not show when debugging. You can monitor up to 4000 characters by using the :C option when monitoring memory:
I have ran into this problem twice now. I am using IBM Rational Developer for i Version: 9.6.0.0, with the Java JDK/JRE v8u45.
Here are the values when debugging, and my data structure definition:
dcl-ds dsSQL qualified inz;
fullStmt varchar( 9360 ) inz;
end-ds;
Once I click on the element, all I see is ``. There is nothing in the value but that, but you can clearly see that dsSQL.fullStmt is not empty. I use this option daily and 99.99% of the time it works fine. I have to restart a million times, reset RDi to start with -c and recompile the program over and over to get it to work right.
Anyone have any idea how to fix this? I would give you the 'Error Log' but it is constantly filled and nothing in there seems to point to that issue. When adding or looking at that variable during debug, no errors are thrown.
You probably want to update to the latest 9.6.0.6 release. They have fixed at least a few memory problems with the debugger between your release and the latest.
https://www-01.ibm.com/support/docview.wss?uid=swg27038481

NSProgressIndicator built-in animation raises CA_ASSERT_MAIN_THREAD_TRANSACTIONS

This looks like a bug in either NSProgressIndicator or Xcode 9 to me:
Run Xcode 9 Beta 1 or Beta 4, in macOS 10.12.6.
File > New Project, macOS, Cocoa app, Objective-C or Swift, ARC or not, no storyboards, latest (10.13) SDK.
In the app target's environment, set CA_ASSERT_MAIN_THREAD_TRANSACTIONS=1.
In app delegate, add a IBOutlet progressIndicator.
In the nib, add a NSProgressIndicator to the window, connect to that outlet. Leave the checkbox Indeterminate switched on.
In -applicationDidFinishLaunching, call -startAnimation: on progressIndicator.
Build and run.
Expected Result:
Progress indicator should happily show indeterminate progress, because I did everything on the main thread.
Actual Result:
App crashes, citing CA_ASSERT_MAIN_THREAD_TRANSACTIONS, when
-startAnimation: is called.
You can see this in a tiny demo project.
Did I do anything wrong? Is my Expected Result incorrect?
P.S. I asked this on Apple's Developer Forums, but still awaiting moderator approval after 2 working days, so I deleted it and came here instead :(
Update: Still lacking an explanation, I filed Apple Bug 33593575.
This was a bug in NSProgressIndicator. Your bug report (thank you for filing!) was marked as a duplicate of an earlier bug, which was already resolved in macOS 10.13.

ADB debugging in Android Studio - some basic issues

Ok, I've squeaked by not needing to use ADB in the Studio, since back
in the 'beta' days of AS. (Just lucky, I guess.) But now, I need to
debug a crashing app.
I've gotten this far:
Learned how to put adb.exe on my Window's 'PATH'
(so that it's invokable from cmd-window):
My path-entry was: C:\Users\David\AppData\Local\Android\sdk\platform-tools
Am assuming that 'logcat' lives on Android device (I was incorrectly guessing it lives on the development machine). I'm assuming this, because when I dis-connect
the USB-cable and enter 'adb logcat' is says waiting for device.
Ok, now my (next) issue: When I fire up the app-being-developed, I'm getting
"Unfortunately has stopped"...which I'm assuming is an app-crash.
And, while I'm looking at 'logcat', I can see a stack-trace flow by. But
as I try to scroll-back to read it, logcat keeps dribbling in more data.
So, how do I tell it to shutup...so that I can look at a static copy
of logcat and see what has happened (without more data dribbling in)?
[If there is other beginner related info, beyond this question, feel free to
to add that info...I'm clearly in need of basic 'adb-related' enlightenment.]
TIA.
Cheers...

WinRT - Windows Store - WinRT Originate Error - How do decipher such an error?

I'm working on a Windows Store app and I'm getting a WinRT error that doesn't really give me any information so I would like to know how to understand these sorts of errors.
Basically I get the error on the following line which is called inside OnPointerPressed:
m_gestureRecognizer->ProcessDownEvent(args->GetCurrentPoint(nullptr));
The error is:
First-chance exception at 0x76F54B32 (KernelBase.dll) in DXAML2.exe: 0x40080201: WinRT originate error (parameters: 0x80070057, 0x00000044, 0x03CEE72C).
This error didn't used to appear, the only thing I've changed is that this line is now wrapped in an if clause which tests if the current pointer's PointerId is the same as one I've stored just using == such as:
if(args->GetCurrentPoint(nullptr)->PointerId == m_UIPointerID)
I have no idea why this has started happening.
So my question is in two parts:
More generally, how do I understand what an error such as the above means?
And does anyone know this error has suddenly started happening now that I check the pointerId?
Thanks for your time.
P.S. I guess another thing that has changed is that there will already be 2 pointers on the screen (the one that gets pushed into this GestureRecognizer) as well as another one, hence the PointerId check.
"How to Decipher such an error"...
For any WinRT originate error, you can take the third address in the parameters list (in your example, 0x03CEE72C), and find a description of your error in the memory window.
While debugging, break when your error is thrown and open the memory window via Debug -> Windows -> Memory -> Memory 1
Copy and paste the address to get your "easy-to-find" error message.
As Raman said - it's good to look up the hex values shown. The first one is the memory location which won't tell you much without the symbols/source, which in this case is reported directly by Windows. Perhaps the public symbols can shed some more light on where the error came from, but the error code lookups are more helpful.
If you Bing for 0x80070057 you will find an MSDN article on Common HRESULT Values which lists
E_INVALIDARG : One or more arguments are not valid : 0x80070057
It doesn't give you all the details of course, so you're off to theorize. Perhaps you can only call args->GetCurrentPoint(nullptr) once and you should store/reuse the value? Maybe gesture recognizer is not configured correctly? Maybe the app window is not visible at the time the exception is thrown or the thread is wrong. Maybe some expected calls to gesture recognizer were missed due to filtering those out with these "if" statements.

HelloWorld Deployment with QtQuick 2.0 in Windows 7 and XP

I've been struggling to get my application deployed properly for several weeks now (it's a hobby), and I just don't know what else to try.
I started a new project in Qt Creator (2.6.1), by selecting Applications -> Qt Quick 2 Application (Built-in Elements). I tweaked the QML to make the background blue and text red:
main.qml
import QtQuick 2.0
Rectangle {
width: 360
height: 360
color: "blue" // Added!
Text {
text: qsTr("Hello World")
anchors.centerIn: parent
color: "red" // Added!
}
MouseArea {
anchors.fill: parent
onClicked: {
Qt.quit();
}
}
}
I'm using Qt 5.0.1 and the x86 MSVC 2010 compiler. I built the Release version and it ran fine in QtCreator. If you need more compiler specifics, I'll post them.
To deploy, I created a new folder on my desktop called HelloWorld/ and copied everything from H:\Qt\Qt5.0.1\5.0.1\msvc2010\bin\* and H:\Qt\Qt5.0.1\5.0.1\msvc2010\plugins\* and 'H:\Qt\Qt5.0.1\5.0.1\msvc2010\qml* into it, along with the Release HelloWorld.exe executable.
Overkill? Yes. But I'm desperate.
When I run HelloWorld/HelloWorld.exe in Windows 7 64-bit, the application runs fine. But when I copy this HelloWorld/ folder over into a virtual machine running Windows XP 32-bit, it shows a properly-sized window, but with nothing in it (white, with no text). When clicking in the center of the window, the window closes as it should.
So I loaded the executable in Dependency Walker, but nothing looked out of the ordinary (IESHIMS.DLL and WER.DLL were of course missing). I ran Start Profile, and got a slew of red errors:
GetProcAddress(0x7C800000 [KERNEL32.DLL], "FlsAlloc") called from "MSVCR100.DLL" at address 0x78ABBA3B and returned NULL. Error: The specified procedure could not be found (127).
GetProcAddress(0x7C800000 [KERNEL32.DLL], "FlsGetValue") called from "MSVCR100.DLL" at address 0x78ABBA48 and returned NULL. Error: The specified procedure could not be found (127).
GetProcAddress(0x7C800000 [KERNEL32.DLL], "FlsSetValue") called from "MSVCR100.DLL" at address 0x78ABBA55 and returned NULL. Error: The specified procedure could not be found (127).
GetProcAddress(0x7C800000 [KERNEL32.DLL], "FlsFree") called from "MSVCR100.DLL" at address 0x78ABBA62 and returned NULL. Error: The specified procedure could not be found (127).
LoadLibraryExW("C:\documents and settings\owner\desktop\helloworld\platforms\qminimald.pdb", 0x00000000, DONT_RESOLVE_DLL_REFERENCES) returned NULL. Error: %1 is not a valid Win32 application (193).
LoadLibraryExW("C:\documents and settings\owner\desktop\helloworld\platforms\qwindowsd.pdb", 0x00000000, DONT_RESOLVE_DLL_REFERENCES) returned NULL. Error: %1 is not a valid Win32 application (193).
GetProcAddress(0x7E410000 [USER32.DLL], "UpdateLayeredWindowIndirect") called from "QWINDOWS.DLL" at address 0x013A8749 and returned NULL. Error: The specified procedure could not be found (127).
GetProcAddress(0x7C9C0000 [SHELL32.DLL], "SHCreateItemFromParsingName") called from "QWINDOWS.DLL" at address 0x013A8997 and returned NULL. Error: The specified procedure could not be found (127).
GetProcAddress(0x7C9C0000 [SHELL32.DLL], "SHGetStockIconInfo") called from "QWINDOWS.DLL" at address 0x013A89C9 and returned NULL. Error: The specified procedure could not be found (127).
GetProcAddress(0x7C800000 [KERNEL32.DLL], "GetTickCount64") called from "QT5CORE.DLL" at address 0x670726A7 and returned NULL. Error: The specified procedure could not be found (127).
GetProcAddress(0x755C0000 [MSCTFIME.IME], "ImeGetImeMenuItems") called from "IMM32.DLL" at address 0x76397354 and returned NULL. Error: The specified procedure could not be found (127).
GetProcAddress(0x4FDD0000 [D3D9.DLL], "Direct3DCreate9Ex") called from "LIBEGL.DLL" at address 0x01487198 and returned NULL. Error: The specified procedure could not be found (127).
I also tried to run a debug version, but I only have the 64-bit versions of the MSVC100 dll's, so I can't copy them to the XP machine (I can only run the 32-bit redistributable). I don't know what other tools I can use to try to solve my problem.
I know I must be doing something stupid, but I really can't find anything on the internet to help. It's really frustrating to spend so much time developing a Qt application, and then get stuck trying to deploy it.
I should note that the program runs just fine in a Windows 7 32-bit virtual machine (after MSVC2012 redistributable has been installed).
The application I'm really interested in running, runs really strangely in Windows XP. When I first run it, the window sizes properly and a couple text strings show up. But none of the Rectangle{} elements are displayed. I left the app running for a few minutes as I made myself some coffee, and when I returned to my computer, the window was blinking random shapes and text, to the beat of the text cursor! What the heck is that?! It looked like a basic math function was screwed up, so parts of the interface were being displayed at improper sizes and positions. I even saw the real interface show up for one blink of the mouse cursor (and yes, the random shapes appear and disappear to the beat of the mouse cursor).
On a whim, I tried using the application (clicking where I know a text box exists), to populate one of the lists, and it worked! The application is running completely fine, except for the graphics. I know Qt 5.0 reworked some of the OpenGL handling, right? Could this be a bug, or maybe a library I haven't installed?
I also encountered the same problem when deploying quick 2.0 application on Windows XP builded by Qt 5.1 rc1 with ANGLE; It's seems to be ANGLE problem, on http://qt-project.org/wiki/Qt-5-on-Windows-ANGLE-and-OpenGL is recommended to use OPENGL for XP, also Qt 5.1 with OPENGL works for me on Windows XP
Install Microsoft Visual C++ 2010 Redistributable Package (x86)
on client machine (windows xp).
Use release build, not debug build, You seems to be using Debug
version.
Don't use OpenGL(Most of XP Users may note have updated OpenGL
version, otherwise‍ you may have to force them to upgrade it.)
Update
Use OpenGL for Windows XP. User have to install or upgrade their OpenGL drivers. Read this.
Try using the MinGW version instead of the VC++ one. It's likely that there are layers and layers of .Net stuff preventing you from running on XP. XP came out before 90% of the current .Net stuff existed which is why it wont work as it's not installed.
Just a guess but its worth a shot.

Resources