Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Issue with malloc on OS X 10.9 Mavericks


This question is not answered. Helpful answers available: 1. Correct answers available: 1.


Permlink Replies: 7 - Last Post: Nov 10, 2014 11:43 AM Last Post By: Peer Dahl
Grant Beattie

Posts: 77
Registered: 11/29/01
Issue with malloc on OS X 10.9 Mavericks  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 21, 2014 4:18 PM
I have an application that works well on Win32 and OS X 10.8.5 Mountain Lion.

When I try and run the same 10.8.5 OS X application (just copied by hand, not recompiled or anything) on 10.9 Mavericks I get an error:

   :
Dyld Error Message:
  Symbol not found: _malloc
  Referenced from: /MacroMasterCPxx.app/Contents/MacOS/MacroMasterCPxx
  Expected in: /usr/lib/system/libsystem_c.dylib
   :


So after much gnashing of teeth I was able to get the application to compile on another (newer) Mac using 10.9 Mavericks SDK. (There were some paths/files that I needed to add to the new SDK). So now when I try and run the application I get more or less the same problem. The application crashes on malloc. One would think that Unix would be as safe as place as any to call malloc.

The debugger pops up a message "Project MacroMasterCPxx raised exception class SIGSEGV (11).

Ideally I would like to have one application for all recent Mac OS's, but I can't even get this one to work at all on 10.9. Is there something I'm missing? What is this error about.
Grant Beattie

Posts: 77
Registered: 11/29/01
Re: Issue with malloc on OS X 10.9 Mavericks  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 21, 2014 4:27 PM   in response to: Grant Beattie in response to: Grant Beattie
It may be that the second case (Mavericks compiled version running on Mavericks) is not the malloc call, but the memset call that happens shortly afterward to clear out the allocated memory (if it is allocated OK). I get a debug assertion failure "obj"in ..\win32src\rproxy.cpp at line 663. I was stepping over the memset. The error details are:

[20356950]{dbkdebugide210.bpl} Debug.TDebugKernel.msgBox (Line 5934, "Debug.pas" + 30) + $0
[03686EB3]{bordbk210.dll} Unknown function at DllUnregisterServer + $5037
[036A37F2]{bordbk210.dll} Unknown function at @isDbkLoggingOn$qv + $991A
[03737FD9]{bordbk210.dll} Unknown function at @isDbkLoggingOn$qv + $9E101
[0369A660]{bordbk210.dll} Unknown function at @isDbkLoggingOn$qv + $788
[0369A6DB]{bordbk210.dll} Unknown function at @isDbkLoggingOn$qv + $803
[0372C4CC]{bordbk210.dll} Unknown function at @isDbkLoggingOn$qv + $925F4
[03699D72]{bordbk210.dll} Unknown function at DllUnregisterServer + $17EF6
[036FB8CC]{bordbk210.dll} Unknown function at @isDbkLoggingOn$qv + $619F4
[036FC7FC]{bordbk210.dll} Unknown function at @isDbkLoggingOn$qv + $62924
[036A425C]{bordbk210.dll} Unknown function at @isDbkLoggingOn$qv + $A384
[036A4263]{bordbk210.dll} Unknown function at @isDbkLoggingOn$qv + $A38B
[5070CE70]{vcl210.bpl  } Vcl.Forms.TCustomForm.WndProc (Line 4427, "Vcl.Forms.pas" + 206) + $5
[505C2828]{vcl210.bpl  } Vcl.Controls.TControl.Perform (Line 7010, "Vcl.Controls.pas" + 10) + $8
[50717FB7]{vcl210.bpl  } Vcl.Forms.TApplication.DispatchAction (Line 11558, "Vcl.Forms.pas" + 9) + $C
[50715713]{vcl210.bpl  } Vcl.Forms.TApplication.WndProc (Line 9921, "Vcl.Forms.pas" + 98) + $B
[5016E214]{rtl210.bpl  } System.Classes.StdWndProc (Line 16598, "System.Classes.pas" + 6) + $1
[50777263]{vcl210.bpl  } Vcl.AppEvnts.TMultiCaster.GetAppEvents (Line 654, "Vcl.AppEvnts.pas" + 1) + $3
[5071633B]{vcl210.bpl  } Vcl.Forms.TApplication.ProcessMessage (Line 10354, "Vcl.Forms.pas" + 25) + $1
[50716376]{vcl210.bpl  } Vcl.Forms.TApplication.HandleMessage (Line 10382, "Vcl.Forms.pas" + 1) + $4
[507166A9]{vcl210.bpl  } Vcl.Forms.TApplication.Run (Line 10520, "Vcl.Forms.pas" + 26) + $3


Also the "problem report" on the mac says:

Crashed Thread:  0  Dispatch queue: com.apple.main-thread
 
Exception Type:  EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000
 
External Modification Warnings:
Debugger attached to process.
 
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   ???                           	0x00096094 0 + 614548
1   MacroMasterCPxx               	0x0001dd41 @TfrmMain@ShowMacro$qqrv + 813
2   MacroMasterCPxx               	0x0001fae2 @TfrmMain@KeyboardClick$qqrp14System@TObject + 1630
3   bplfmx210.dylib               	0x00df464f @Fmx@Controls@TControl@Click$qqrv + 471
4   bplfmx210.dylib               	0x00d10245 @Fmx@Stdctrls@TCustomButton@Click$qqrv + 33
5   bplfmx210.dylib               	0x00ea29a5 @Fmx@Forms@TCommonCustomForm@MouseUp$qqr27System@Uitypes@TMouseButton60System@%Set$32System@Classes@System_Classes__1t1$i0$t1$i10$%ffo + 225
6   bplfmx210.dylib               	0x00f85f84 @Fmx@Platform@Mac@TDownKeyList@$bcdtr$qqrv + 6496
7   bplfmx210.dylib               	0x00f8617b @Fmx@Platform@Mac@TDownKeyList@$bcdtr$qqrv + 6999
8   bplfmx210.dylib               	0x00f8ac58 @Fmx@Platform@Mac@TDownKeyList@$bcdtr$qqrv + 26164
9   bplrtl210.dylib               	0x002db8aa @Macapi@Objectivec@MangleParameters$qqrxp23System@Rtti@TRttiMethod + 2294
10  com.apple.AppKit              	0x97818ebb -[NSWindow sendEvent:] + 719
11  com.apple.AppKit              	0x977b78fd -[NSApplication sendEvent:] + 4034
12  com.apple.AppKit              	0x975fc1fc -[NSApplication run] + 823
13  bplrtl210.dylib               	0x002dbbff @Macapi@Objectivec@WrapInterface$qqrpvt1t1 + 791
14  bplfmx210.dylib               	0x00f86e56 @Fmx@Platform@Mac@TDownKeyList@$bcdtr$qqrv + 10290
15  MacroMasterCPxx               	0x00019ccf FMXmain + 219
16  MacroMasterCPxx               	0x00012e76 _start + 138


Hope it helps.
Grant Beattie

Posts: 77
Registered: 11/29/01
Re: Issue with malloc on OS X 10.9 Mavericks  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 22, 2014 11:29 AM   in response to: Grant Beattie in response to: Grant Beattie
Here is my workaround for this (incidentally I updated my iMac to OS 10.9.5 Mavericks but I don't think that mattered). In this case I solved the memset() issue by doing a direct assignment from a structure previously zeroed out.

The new code looks like:

TKEYCELL *pKeyCells;           // Global Root.
TKEYCELL BlankKeyCell;       // [XE7] Global zeroed var.
 
 
 
// Make the root cell.
pKeyCells = (TKEYCELL *)malloc(sizeof(TKEYCELL));
if(pKeyCells == NULL)
   return 0;                 // Should not exit here.
 
//memset(pKeyCells, 0, sizeof(TKEYCELL));
*pKeyCells = BlankKeyCell;   // [XE7] Mac fix for memset()?


---

I have not tried the old executable compiled and targeted to 10.8.5 Mountain Lion on Mavericks since I updated my Mavericks but I assume the malloc() issue still exists. In that case the Mac reported a problem _malloc() not found as mentioned before:

Dyld Error Message:
Symbol not found: _malloc Referenced from:

Expected in: /usr/lib/system/libsystem_c.dylib :

---

I now have to look at some RTL issues with Mavericks. I can't get any dialogs to open up without crashing the appl.

Peer Dahl

Posts: 21
Registered: 6/23/02
Re: Issue with malloc on OS X 10.9 Mavericks
Helpful
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 27, 2014 5:11 PM   in response to: Grant Beattie in response to: Grant Beattie
Hello Grant,

I have the same issues since XE 4 and wrote serveral posts in this forum and to QC - without a solution.

The abstract
is that there is a cut between OSX 10.8 (Mountain Lion) and OSX 10.9 (Mavericks). It is not possible to have an app that runs in both "OSX-worlds" builded with XE. So I decided to give up and forget the past and only offer versions for OSX 10.9 and higher. It is clear that this is a sad economic disadvantage.

Hint: If you want to sell your apps via the app store you probable still need your OSX 10.8.5 Mac to codesign the app because this is a task that does not run on a OSX 10.9 Mac on the other hand. So in this case think twice before you update your Mountain Lion Mac to OSX 10.9.

In my case at the moment I use two Macs. An OSX 10.9 Mac for development and an OSX 10.8.5 Mac for the codesigning.

Perhaps one day a XE version will dissolve all this again but we can even be happy if OSX 10.10 can be survived.

Best regards
Peer
Grant Beattie

Posts: 77
Registered: 11/29/01
Re: Issue with malloc on OS X 10.9 Mavericks  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 28, 2014 10:37 AM   in response to: Peer Dahl in response to: Peer Dahl
Thanks. Personally I can live with multiple versions. It's not ideal and an extra burden when making updates to my app.
But what has me confused now (among other things) is that I have updated both my machines. 10.8 -> 10.8.5 and
10.9 -> 10.9.5. So how does this affect compatibility for my users? If I target for 10.x.5 is it backward compatible? I have
no extra mac(s) to test it on now. And now 10.10 drops... :-(
Peer Dahl

Posts: 21
Registered: 6/23/02
Re: Issue with malloc on OS X 10.9 Mavericks  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 28, 2014 3:08 PM   in response to: Grant Beattie in response to: Grant Beattie
The main cut for XE apps is between OSX 10.8.x and 10.9.x (don't hope that OSX 10.10 will cause new problems).
The subversions x should not be too critical, as they are often for bugfixings and apple affairs.
Grant Beattie

Posts: 77
Registered: 11/29/01
Re: Issue with malloc on OS X 10.9 Mavericks  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 5, 2014 9:40 AM   in response to: Peer Dahl in response to: Peer Dahl
Peer Dahl wrote:

Hint: If you want to sell your apps via the app store you probable still need your OSX 10.8.5 Mac to codesign the app because this is a task that does not run on a OSX 10.9 Mac on the other hand. So in this case think twice before you update your Mountain Lion Mac to OSX 10.9.

In my case at the moment I use two Macs. An OSX 10.9 Mac for development and an OSX 10.8.5 Mac for the codesigning.

OK this is an interesting point. I'm having trouble building my app for the App Store even though I intend to distribute it myself and I am having all kinds of trouble. Can you explain more about this requirement to code sign on 10.8.5? I've been trying to do it on 10.9.5 and I keep getting errors. See the following threads to give you an idea.

https://forums.embarcadero.com/thread.jspa?messageID=677329

https://devforums.apple.com/message/1069431
Peer Dahl

Posts: 21
Registered: 6/23/02
Re: Issue with malloc on OS X 10.9 Mavericks  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 10, 2014 11:43 AM   in response to: Grant Beattie in response to: Grant Beattie
My solution to develop for OSX 10.9.x and codesign the app on a OSX 10.8.x Mac did work perfectly. But since Oktober 2014 apple does not accept apps anymore that are codesigned with a Mountain Lion OSX 10.8.x Mac.

Additionally they changed the file structure. The entitlements.plist must not be placed in the contents-folder anymore becuse the apple automat sees this file as "not codesigned at all" then. But nobody seems to know where to place the file now.

The changes were introduced while my last app was already a few weeks waiting for review.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02