So I'm getting the annoying EXC_BAD_ACCESS error...
With zombies I see that it's the MTLSamplerState that has to do with the crash:
*** -[MTLDebugSamplerState retain]: message sent to deallocated instance 0x1c9065c40
This is how I declare it:
let sampler_descriptor = MTLSamplerDescriptor()
sampler_descriptor.minFilter = .linear
sampler_descriptor.magFilter = .linear
sampler_descriptor.sAddressMode = .clampToZero
sampler_descriptor.tAddressMode = .clampToZero
let sampler_state = self.device!.makeSamplerState(descriptor: sampler_descriptor)!
I later in the same function, where the error happens, I access the sampler like this:
renderCommandEncoder.setFragmentSamplerState(sampler_state, index: 0)
The crash happens randomly at different times in my program, but not always, not sure how to debug in further...
Why would sampler_state be deallocated? Isn't Swift suppose to do ARC?
Update:
Here's the stack trace:
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=1, subcode=0x18339161c)
frame #0: 0x000000018339161c CoreFoundation`___forwarding___ + 1180
frame #1: 0x00000001832770dc CoreFoundation`_CF_forwarding_prep_0 + 92
* frame #2: 0x00000001020c2b14 Test App`MetalView.render(view=0x0000000105111000, self=0x0000000105111000) at MetalView.swift:378
frame #3: 0x00000001020c0d38 Test App`closure #1 in MetalView.draw(rect=(origin = (x = 0, y = 0), size = (width = 112.5, height = 112.5)), self=0x0000000105111000) at MetalView.swift:238
frame #4: 0x00000001020c36dc Test App`thunk for #callee_owned () -> (#error #owned Error) at MetalView.swift:0
frame #5: 0x00000001020c6ff0 Test App`partial apply for thunk for #callee_owned () -> (#error #owned Error) at MetalView.swift:0
frame #6: 0x0000000103c24e1c libswiftObjectiveC.dylib`ObjectiveC.autoreleasepool<A>(invoking: () throws -> A) throws -> A + 68
frame #7: 0x00000001020c0c0c Test App`MetalView.draw(rect=(origin = (x = 0, y = 0), size = (width = 112.5, height = 112.5)), self=0x0000000105111000) at MetalView.swift:240
frame #8: 0x00000001020c3798 Test App`#objc MetalView.draw(_:) at MetalView.swift:0
frame #9: 0x0000000196844ed0 MetalKit`-[MTKView draw] + 140
frame #10: 0x0000000187368010 QuartzCore`-[CALayer display] + 188
frame #11: 0x00000001872dbfdc QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 520
frame #12: 0x0000000187302340 QuartzCore`CA::Transaction::commit() + 540
frame #13: 0x00000001872570d4 QuartzCore`CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 928
frame #14: 0x0000000187307fa4 QuartzCore`display_timer_callback(__CFMachPort*, void*, long, void*) + 236
frame #15: 0x000000018331a080 CoreFoundation`__CFMachPortPerform + 188
frame #16: 0x00000001833349dc CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 56
frame #17: 0x00000001833340e0 CoreFoundation`__CFRunLoopDoSource1 + 440
frame #18: 0x0000000183331bb4 CoreFoundation`__CFRunLoopRun + 2196
frame #19: 0x00000001832522d8 CoreFoundation`CFRunLoopRunSpecific + 436
frame #20: 0x00000001850e3f84 GraphicsServices`GSEventRunModal + 100
frame #21: 0x000000018c7ff880 UIKit`UIApplicationMain + 208
frame #22: 0x000000010231a1e8 Test App`main at AppDelegate.swift:13
frame #23: 0x0000000182d7656c libdyld.dylib`start + 4
Related
I am trying to implement a discrete stochastic simulation using tools from DifferentialEquations.jl. It works great for earlier time-points but does not do any jumps later on, inexplicably.
using DifferentialEquations
using Plots
#initial conditions
far1_ic = 0
cln_ic = 100
ste12_ic = 1000
far1cln_ic = 0
u0 = [far1_ic, cln_ic, ste12_ic, far1cln_ic]
#paramaters
#Far1
ks_F = 10 #1
kd_F = 0.01 #2
kd_F_C = 0.01 #3
kA_C = 200 #4
ks_F_S = 200 #5
#Cln
ks_C = 10 #6
kd_C = 0.1 #7
kA_F = 500 #8
ks_C_C = 100 #9
#Ste12
ks_S_alpha = 80 #10
ks_S = 1 #11
ks_S_S = 100 #12
kd_S = 0.01 #13
kA_S = 500 #14
kd_S_F = 0.005 #15
#Far1Cln
ks_FC = 100 #16
kd_FC = 0.05 #17
krev_FC = 600 #18
#misc
alpha = 17 #19
power_alpha = 1 #20
alpha_halfmax = 50 #21
p = [ks_F, kd_F, kd_F_C, kA_C, ks_F_S, ks_C, kd_C, kA_F, ks_C_C,
ks_S_alpha, ks_S, ks_S_S, kd_S, kA_S, kd_S_F, ks_FC, kd_FC,
krev_FC, alpha, power_alpha, alpha_halfmax];
s_far1(u,p,t) = (p[5] * ((u[3]^2)/(u[3]^2+p[14]^2)) + p[1]) * (p[19]^p[20]/(p[19]^p[20]+p[21]^p[20]))
d_far1(u,p,t) = p[2]*u[1] + p[3]*u[1]*u[2]
s_cln(u,p,t) = p[6] + p[9]*((u[2]^2)/(u[2]^2+p[4]^2))
d_cln(u,p,t) = p[7]*u[2]
s_ste12(u,p,t) = p[11]+(p[10]+p[12]*(u[3]^2/(u[3]^2+p[14]^2)))*(p[19]^p[20]/(p[19]^p[20]+p[21]^p[20]))
d_ste12(u,p,t) = p[13]*u[3] + p[15]*u[1]*u[3]
s_far1cln(u,p,t) = p[16]*u[1]*u[2]
d_far1cln(u,p,t) = p[17]*u[4]
r_far1cln(u,p,t) = p[18]*u[4]
function syn_f(integrator)
integrator.u[1] += 1
end
function deg_f(integrator)
integrator.u[1] -= 1
end
function syn_c(integrator)
integrator.u[2] += 1
end
function deg_c(integrator)
integrator.u[2] -= 1
end
function syn_s(integrator)
integrator.u[3] += 1
end
function deg_s(integrator)
integrator.u[3] -= 1
end
function syn_fc(integrator)
integrator.u[4] += 1
integrator.u[1] -= 1
integrator.u[2] -= 1
end
function deg_fc(integrator)
integrator.u[4] -= 1
end
function rev_fc(integrator)
integrator.u[4] -= 1
integrator.u[1] += 1
integrator.u[2] += 1
end
jump1 = ConstantRateJump(s_far1, syn_f)
jump2 = ConstantRateJump(d_far1, deg_f)
jump3 = ConstantRateJump(s_cln, syn_c)
jump4 = ConstantRateJump(d_cln, deg_c)
jump5 = ConstantRateJump(s_ste12, syn_s)
jump6 = ConstantRateJump(d_ste12, deg_s)
jump7 = ConstantRateJump(s_far1cln, syn_fc)
jump8 = ConstantRateJump(d_far1cln, deg_fc)
jump9 = ConstantRateJump(r_far1cln, rev_fc)
p[19] = 27 # reset parameter alpha
tspan = (0.0,600.0) #time span
prob = DiscreteProblem(u0,tspan,p) # variables must be discrete. Provide IC, span, paramaters.
jump_prob = JumpProblem(prob,DirectFW(),jump1,jump2,jump3,jump4,jump5,jump6,jump7,jump8,jump9,save_positions=(false,false))
sol = solve(jump_prob,SSAStepper(),saveat=1);
plot of simulation
I have tried saving all positions instead of only at every integer. I have tried using Direct instead of DirectFW. I have tried using default instead of SSAStepper. I checked the ODESolution object and it really does just repeat the same values at each timestep later on; it's not just the plot.
Really appreciate any advice!
This was a bug that has been fixed. Run ]up and your code will work.
I am attempting to write a program that executes Monte Carlo simulations using OpenCL. I have run into an issue involving exponentials. When the value of the variable steps becomes large, approximately 20000, the calculation of the exponent fails unexpectedly, and the program quits with "Abort Trap: 6". This seems to be a bizarre error given that steps should not affect memory allocation. I have tried setting normal, alpha, and beta to 0 but this does not resolve the problem however commenting out the exponent and replacing it with the constant 1 seems to fix the problem. I have run my code on an AWS GPU instance and it does not run into any issues. Does anybody have any ideas as to why this might be a problem on an integrated graphics card?
SOLUTION
Execute the kernel multiple times over a smaller ranges to keep kernel execution time under 5 seconds
Code Snippet
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
static uint MWC64X(uint2 *state) {
enum { A = 4294883355U };
uint x = (*state).x, c = (*state).y;
uint res = x ^ c;
uint hi = mul_hi(x, A);
x = x * A + c;
c = hi + (x < c);
*state = (uint2)(x, c);
return res;
}
__kernel void discreteMonteCarloKernel(...) {
float cumulativeWalk = stockPrice;
float currentValue = stockPrice;
...
uint n = get_global_id(0);
uint2 seed2 = (uint2)(n, seed);
uint random1 = MWC64X(&seed2);
uint2 seed3 = (uint2)(random1, seed);
uint random2 = MWC64X(&seed3);
float alpha = (interestRate - 0.5 * sigma * sigma) * dt;
float beta = sigma * sqrt(dt);
float u1;
float u2;
float a;
float b;
float normal;
for (int j = 0; j < steps; j++) {
random1 = MWC64X(&seed2);
if (random1 == 0) {
random1 = MWC64X(&seed2);
}
random2 = MWC64X(&seed3);
u1 = (float)random1 / (float)0xffffffff;
u2 = (float)random2 / (float)0xffffffff;
a = sqrt(-2 * log(u1));
b = 2 * M_PI * u2;
normal = a * sin(b);
exponent = exp(alpha + beta * normal);
currentValue = currentValue * exponent;
cumulativeWalk += currentValue;
...
}
Problem Report
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Application Specific Information:
abort() called
Application Specific Signatures:
Graphics hardware encountered an error and was reset: 0x00000813
Thread 0 Crashed:: Dispatch queue: opencl_runtime
0 libsystem_kernel.dylib 0x00007fffb14bad42 __pthread_kill + 10
1 libsystem_pthread.dylib 0x00007fffb15a85bf pthread_kill + 90
2 libsystem_c.dylib 0x00007fffb1420420 abort + 129
3 libGPUSupportMercury.dylib 0x00007fffa98e6fbf gpusGenerateCrashLog + 158
4 com.apple.driver.AppleIntelHD5000GraphicsGLDriver 0x000000010915f13b gpusKillClientExt + 9
5 libGPUSupportMercury.dylib 0x00007fffa98e7983 gpusQueueSubmitDataBuffers + 168
6 com.apple.driver.AppleIntelHD5000GraphicsGLDriver 0x00000001091aa031 IntelCLCommandBuffer::getNew(GLDQueueRec*) + 31
7 com.apple.driver.AppleIntelHD5000GraphicsGLDriver 0x00000001091a9f99 intelSubmitCLCommands(GLDQueueRec*, unsigned int) + 65
8 com.apple.driver.AppleIntelHD5000GraphicsGLDriver 0x00000001091b00a1 CHAL_INTEL::ChalContext::ChalFlush() + 83
9 com.apple.driver.AppleIntelHD5000GraphicsGLDriver 0x00000001091aa2c3 gldFinishQueue + 43
10 com.apple.opencl 0x00007fff9ffeeb37 0x7fff9ffed000 + 6967
11 com.apple.opencl 0x00007fff9ffef000 0x7fff9ffed000 + 8192
12 com.apple.opencl 0x00007fffa000ccca 0x7fff9ffed000 + 130250
13 com.apple.opencl 0x00007fffa001029d 0x7fff9ffed000 + 144029
14 libdispatch.dylib 0x00007fffb13568fc _dispatch_client_callout + 8
15 libdispatch.dylib 0x00007fffb1357536 _dispatch_barrier_sync_f_invoke + 83
16 com.apple.opencl 0x00007fffa001011d 0x7fff9ffed000 + 143645
17 com.apple.opencl 0x00007fffa000bda6 0x7fff9ffed000 + 126374
18 com.apple.opencl 0x00007fffa00011df clEnqueueReadBuffer + 813
19 simplisticComparison 0x0000000107b953cf BinomialMultiplication::execute(int) + 1791
20 simplisticComparison 0x0000000107b9ec7f main + 767
21 libdyld.dylib 0x00007fffb138c235 start + 1
Thread 1:
0 libsystem_pthread.dylib 0x00007fffb15a50e4 start_wqthread + 0
1 ??? 0x000070000eed6b30 0 + 123145552751408
Thread 2:
0 libsystem_pthread.dylib 0x00007fffb15a50e4 start_wqthread + 0
Thread 3:
0 libsystem_pthread.dylib 0x00007fffb15a50e4 start_wqthread + 0
1 ??? 0x007865646e496d65 0 + 33888479226719589
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000000000000 rbx: 0x0000000000000006 rcx: 0x00007fff58074078 rdx: 0x0000000000000000
rdi: 0x0000000000000307 rsi: 0x0000000000000006 rbp: 0x00007fff580740a0 rsp: 0x00007fff58074078
r8: 0x0000000000000000 r9: 0x00007fffb140ba50 r10: 0x0000000008000000 r11: 0x0000000000000206
r12: 0x00007f92de80a7e0 r13: 0x00007f92e0008c00 r14: 0x00007fffba29e3c0 r15: 0x00007f92de801a00
rip: 0x00007fffb14bad42 rfl: 0x0000000000000206 cr2: 0x00007fffba280128
Logical CPU: 0
Error Code: 0x02000148
Trap Number: 133
I have a guess. The driver can crash in two ways:
We reference a bad buffer address. This is probably not your case.
We time out (exceed the TDR). A kernel has a few seconds to complete.
My money is on #2. If the larger value (steps) makes the GPU run too long, the system will kill things.
I am not familiar with the guts of Apple's Intel driver, but typically there is a way to disable the TDR in extreme cases. E.g. see the Windows Documenation on TDRs to get the gist. (Linux drivers have a way to disable this too.)
Normally we want to avoid running things that take super long and it might be a good idea to decompose the workload in some way so that you naturally don't hit this kill switch. E.g. perhaps chunk the "steps" into smaller chunks (pass in and save your state for parts you can't recompute).
I need to create dynamic forecast using
v(t) = b0 + b1*v(t-1) + b2*v(t-2) + b3*x(t-1) + b4*x(t-2)
The dataset looks like this at time 0. In actual data, there are 80 different x's and 100K "dates".
date v vLag1 vLag2 x xLag1 xLag2 b1 b2 b3 b4
2016-06-30 NA 105 95 33 11 23 0.2 3.2 -1.2 0.4
2016-07-01 NA NA NA 43 33 11 0.2 3.2 -1.2 0.4
2016-07-02 NA NA NA 52 43 33 0.2 3.2 -1.2 0.4
The goal is to predict v's, replacing all NA's with values. I created vLag1, vLag2, xLag1, xLag2 so that I have all I need to calculate v in one row.
All x's and b's are known ahead of time, so I created lags of x shown above. The b's are the coefficients.
For each date, the v(t) would be predicted, and the predicted v(t)'s will feed into the next date's v prediction as the lagged regressors.
To avoid looping over rows like this:
for (i in 2:nrows){
df$v[i] <- df$v[i-1] * df$coeff[i]
}
I have tried to use repeated substitution, so that all the future v's only reference v1, which is easy to calculate because v1's calculation involves other values in the same row.
v2 = b0 + b1*v1 + b2*v0 + b3*x1 + b4*x0
v3 = b0 + b1*v2 + b2*v1 + b3*x2 + b4*x1
(substitute v2) v3 = b0 + b1*(b0 + b1*v1 + b2*v0 + b3*x1 + b4*x0) + b2*v1 + b3*x2 + b4*x1
v4 = ...
But with so many lags of v's and x's to keep track, this also got out of control.
I have been browsing the data.table's shift function in SO. But, in my case, where the the values need to be dynamically obtained and then shifted, is there any way to dynamically predict in data.table's functions?
Instead of data.table (where you can't do this easily) this looks like an easy job for Rcpp:
#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
NumericVector dyn_fore(const NumericVector x,
const double v1, const double v2,
const double x1, const double x2,
const double b0, const double b1, const double b2,
const double b3, const double b4) {
int n = x.size();
NumericVector v(n);
v(0) = b0 + b1*v1 + b2*v2 + b3*x1 + b4*x2;
v(1) = b0 + b1*v(0) + b2*v1 + b3*x(0) + b4*x1;
for (int i = 2; i < n; i++) {
v(i) = b0 + b1*v(i-1) + b2*v(i-2) + b3*x(i-1) + b4*(i-2);
}
return v;
}
(If you use Windows, make sure you have a working Rtools installation, put this in an C++ File in RStudio and source it. Check if I got coefficients and indices right.)
Then in R:
x <- c(33, 43, 52, 67)
dyn_fore(x, 105, 95, 11, 23, 0, 0.2, 3.2, -1.2, 0.4)
#[1] 321.00 365.00 1048.60 1315.72
I am trying to print coordinate outputs of a program to a text file in order to use it in another program but I don't really know anything about GWBASIC and its my first time using MS-DOS. I need it to open a text file named plot.txt and print output there and save it without actually plotting on GWBASIC. Here is the program which I found in an old magazine.
810 REM MAKE A GLOBULAR
12 REM
14 R0=20: R2=R0*R0: R3=R2*R0
16 P1=3.14159265#
18 C0=P1*P1*R3/4
20 R1=R0/SQR(2)
22 XM=512: YM=512
24 X2=XM/2: Y2=YM/2: S=5
26 INPUT "HOW MANY STARS ";T
27 RANDOMIZE TIMER
28 CLS: REM CLEAR SCREEN
30 FOR I=1 TO T
32 C=C0*RND: R=R1
34 REM
36 REM NOW FIND R
38 FOR K=1 TO 5
40 GOSUB 100
42 R=R+(C-C1)/D
44 NEXT K
46 REM 3-DIMENSIONAL PLACE
48 X=RND-.5
50 Y=RND-.5
52 Z=RND-.5
54 S1=SQR(X*X+Y*Y+Z*Z)
56 IF S1>.5 THEN GOTO 48
58 REM POINT IS NOW IN SPHERE
60 R=R*S1: X=X*R: Y=Y*R: Z=Z*R
62 GOSUB 200
64 NEXT I
66 END
68 REM
100 REM NEWTON-RAPHSON ITERATION
105 A=R/R0
110 C1=ATN(A)*.5*R3
115 A=1+A*A
120 C1=C1+R*.5*R2/A
125 C1=P1*(C1-R*R2/(A*A))
130 D=4*P1*R*R/(A*A*A)
135 RETURN
140 REM
200 REM 2-DIMENSIONAL PLOT
203 SCREEN 9
205 X=X*S+X2: Y=Y*S+Y2
210 IF X<0 OR Y<0 THEN 225
215 IF X>=XM OR Y>=YM THEN 225
220 PSET(X,Y)
225 RETURN
230 REM ------------------------
240 REM APPEARED IN ASTRONOMICAL
250 REM COMPUTING, SKY & TELE-
260 REM SCOPE, APRIL, 1986
270 REM ------------------------
Here is a Python 3 paraphrase:
#globular.py
#Python paraphrase of model.bas from
#http://www.skyandtelescope.com/wp-content/uploads/model.bas
from math import pi, sqrt, atan
from random import uniform, random
#Global variables:
r0 = 20.0
r2 = r0**2
r3 = r0**3
c0 = pi**2*r3/4
r1 = r0/sqrt(2)
def NRI(c,r):
#Newton-Raphson Iteration
a = r/r0
c1 = atan(a)*0.5*r3
a = 1+a**2
c1 += r*0.5*r2/a
c1 = pi*(c1-r*r2/a**2)
d = 4*pi*r**2/a**3
return (c1,d)
def makeStars(t):
stars = []
for i in range(t):
c = c0*random()
r = r1
for k in range(5):
c1,d = NRI(c,r)
r += (c-c1)/d
while True:
x = uniform(-0.5,0.5)
y = uniform(-0.5,0.5)
z = uniform(-0.5,0.5)
s1 = sqrt(x**2 + y**2 + z**2)
if s1 <= 0.5: break
r *= s1
x *= r
y *= r
z *= r
stars.append((x,y,z))
return stars
def starsToFile(t,fname):
stars = makeStars(t)
f = open(fname,'w')
for star in stars:
print(*star, sep = ', ',file = f)
f.close()
I skipped the part about printing x and y and instead wrote a function makeStars to return a list of (x,y,z) tuples, as well as a related function which takes such an output and sends it to a text file. This last function is the only thing that used Python 3 instead of Python 2. If you are using Python 2 you can import Python 3's print function from the future.
Typing starsToFile(100,'stars.txt') in the Python shell gave me a text file which begins:
-0.32838465248713156, -0.3294895266926551, -1.2963580524762535
14.20224408569865, 1.4434961933043464, 6.450969593697097
1.6525937589658193, -0.24447292610082685, 1.0543647986350608
1.5707528567123823, 5.190972598268825, -2.0054790217091134
I don't have good 3-d scatter-plot graphing at my finger tips, but here is a screen shot of 50 points generated by the function and plotted using a computer algebra system called Derive:
Final remark: I wonder if there is a typo in the source code. The line
C0=P1*P1*R3/4
strikes me as suspicious since it is fairly rare in mathematics for pi to appear squared -- though it does happen. Maybe there should be only 1 factor of pi there (which would then have the effect of setting C0 proportional to the volume of the sphere of radius R0). On the other hand, I don't know exactly what is happening here, so I left it in. If the results seem problematic, you could maybe experiment with that line.
If you want a copy of the calculated coordinates simply add these lines:
1 OPEN "PLOT.TXT" FOR OUTPUT AS #1
65 CLOSE #1
221 PRINT #1, X + "," + Y
The program will work as before but in addition to this it outputs the coordinate to a file named plot.txt
Put them in an image with 640x350 size (that size is demanded by SCREEN 9) and you get the same result.
Here is a strange issue I am having with sound in an iOS app.
Since my code works about 90% of the time, it is not that easy to reproduce the bug.
But the problem seems to happen (once in a while) at the end of a recording; either when I stop the recording manually or when it stops automatically.
Under the debugger I see the crash showing up at a point in the program related to the plugging in/out of an earphone.
In reality there is no earphone plugged in and I am not plugging in or out any earphone at all.
I have this code at some point in my program:
AudioSessionPropertyID routeChangeID=kAudioSessionProperty_AudioRouteChange;
AudioSessionAddPropertyListener(routeChangeID,svcHandleRouteChange,(__bridge void *)(self));
and this:
void svcHandleRouteChange(void *inUserData,AudioSessionPropertyID inPropertyID,
UInt32 inPropertyValueSize,const void *inPropertyValue)
{
CFStringRef route;
UInt32 propertySize=sizeof(CFStringRef);
if (AudioSessionGetProperty(kAudioSessionProperty_AudioRoute,&propertySize,&route)==0) {
NSString *routeString = (__bridge NSString *) route;
if ([routeString isEqualToString: #"Headphone"]) {
// A headphone is now plugged in.
// We do nothing.
} else if ([routeString isEqualToString: #"Speaker"]) {
// No headphone is plugged in. The device is using the speaker.
LocalViewController* this=(__bridge LocalViewController*)inUserData;
//[this->audioPlayer pause]; // The private variable audioPlayer could be accessed like this.
[this headPhoneOut];
} else {
// This should not happen!!
}
}
}
The crash is happening in the line:
LocalViewController* this=(__bridge LocalViewController*)inUserData;
And finally here is the backtrace I get in the debugger after the crash in case that may help someone to give me a hint:
(lldb) bt
* thread #5: tid = 0x292d8, 0x3abba0ec libobjc.A.dylib`objc_retain + 12, stop reason = EXC_BAD_ACCESS (code=1, address=0x6e966a29)
frame #0: 0x3abba0ec libobjc.A.dylib`objc_retain + 12
frame #1: 0x000eb7d6 parl100`svcHandleRouteChange(inUserData=0x14e5f190, inPropertyID=1919902568, inPropertyValueSize=4, inPropertyValue=0x14f0b120) + 182 at LocalViewController.m:801
frame #2: 0x301ae944 AudioToolbox`AudioSessionPropertyListeners::CallPropertyListenersImp(unsigned long, unsigned long, void const*) + 684
frame #3: 0x301ae456 AudioToolbox`AudioSessionPropertyListeners::CallPropertyListeners(unsigned long, unsigned long, void const*) + 334
frame #4: 0x301aee90 AudioToolbox`HandleCFPropertyListChange(unsigned int, unsigned long, unsigned char*, unsigned int) + 412
frame #5: 0x301aec7e AudioToolbox`HandleAudioSessionPropertyChangedBlobListenerMessage(unsigned int, void*, unsigned int) + 206
frame #6: 0x301aeb0e AudioToolbox`ASCallbackReceiver_AudioSessionPropertyChangedBlobListenerMessage + 178
frame #7: 0x301aea3e AudioToolbox`_XAudioSessionPropertyChangedBlobListenerMessage + 94
frame #8: 0x301ae088 AudioToolbox`mshMIGPerform + 124
frame #9: 0x308dc9e6 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 34
frame #10: 0x308dc982 CoreFoundation`__CFRunLoopDoSource1 + 346
frame #11: 0x308db156 CoreFoundation`__CFRunLoopRun + 1398
frame #12: 0x30845ce6 CoreFoundation`CFRunLoopRunSpecific + 522
frame #13: 0x30845aca CoreFoundation`CFRunLoopRunInMode + 106
frame #14: 0x2f837588 libAVFAudio.dylib`GenericRunLoopThread::Entry(void*) + 128
frame #15: 0x2f82ba96 libAVFAudio.dylib`CAPThread::Entry(CAPThread*) + 178
frame #16: 0x3b1e4c1c libsystem_pthread.dylib`_pthread_body + 140
frame #17: 0x3b1e4b8e libsystem_pthread.dylib`_pthread_start + 102
(lldb)
Here is a second case where the same problem happens at a different point in the app:
2013-10-23 12:25:12.135 parl100[1532:60b] audioRecorderDidFinishRecording
(lldb) bt
* thread #5: tid = 0x2b37a, 0x3abba0ec libobjc.A.dylib`objc_retain + 12, stop reason = EXC_BAD_ACCESS (code=1, address=0xd0003511)
frame #0: 0x3abba0ec libobjc.A.dylib`objc_retain + 12
frame #1: 0x000f18a2 parl100`cvcHandleRouteChange(inUserData=0x176b5610, inPropertyID=1919902568, inPropertyValueSize=4, inPropertyValue=0x1762d660) + 182 at ZapViewController.m:566
frame #2: 0x301ae944 AudioToolbox`AudioSessionPropertyListeners::CallPropertyListenersImp(unsigned long, unsigned long, void const*) + 684
frame #3: 0x301ae456 AudioToolbox`AudioSessionPropertyListeners::CallPropertyListeners(unsigned long, unsigned long, void const*) + 334
frame #4: 0x301aee90 AudioToolbox`HandleCFPropertyListChange(unsigned int, unsigned long, unsigned char*, unsigned int) + 412
frame #5: 0x301aec7e AudioToolbox`HandleAudioSessionPropertyChangedBlobListenerMessage(unsigned int, void*, unsigned int) + 206
frame #6: 0x301aeb0e AudioToolbox`ASCallbackReceiver_AudioSessionPropertyChangedBlobListenerMessage + 178
frame #7: 0x301aea3e AudioToolbox`_XAudioSessionPropertyChangedBlobListenerMessage + 94
frame #8: 0x301ae088 AudioToolbox`mshMIGPerform + 124
frame #9: 0x308dc9e6 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 34
frame #10: 0x308dc982 CoreFoundation`__CFRunLoopDoSource1 + 346
frame #11: 0x308db156 CoreFoundation`__CFRunLoopRun + 1398
frame #12: 0x30845ce6 CoreFoundation`CFRunLoopRunSpecific + 522
frame #13: 0x30845aca CoreFoundation`CFRunLoopRunInMode + 106
frame #14: 0x2f837588 libAVFAudio.dylib`GenericRunLoopThread::Entry(void*) + 128
frame #15: 0x2f82ba96 libAVFAudio.dylib`CAPThread::Entry(CAPThread*) + 178
frame #16: 0x3b1e4c1c libsystem_pthread.dylib`_pthread_body + 140
frame #17: 0x3b1e4b8e libsystem_pthread.dylib`_pthread_start + 102
(lldb)
I can provide more code if necessary. Just tell me what I should include.
I hope someone can point me to something I must not be doing the proper way.