killer mem context

I posted this in qdn.public.photon a while back. Now we’ve
got even more customers yelling at us, complaining about Photon
crashing, sin crashing, and blaming it on us :frowning:

So here’s another posting of the killer mem context / shared memory.
Let it run for 5-10 minutes and pterms and sin commands won’t work
for lack of memory.

This is on QNX 4.25, Photon 1.14. The killer code is attached.

Hi,

A while back, I posted on tin a report about a memory leak, either
with memory context or maybe with shared memory. Julian Thornhill was
able to reproduce this. Any luck reproducing it at your end?
Will there be a patch to fix it? When? Or is there a bug in my sample
app? See the 0007.batch archive, rnews 2771 for a reminder.

Mike Royer




begin 666 mem_ctxt_bug.c
M+RH@;65M7V-T>β€˜1?8G5G+F,)(" @(" @(" @(" @(" @(" @(" @(" @(" @
M(" @(" @(" @(" @(" @(" @(" @B*+RH@(" @(" @(" @(" @(" @(" @
M(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @
M(" J+PHO
B!4:&ES(&1E;6]N<W1R871E<R!H;W<@;65M;W)Y(&-O;G1E>β€˜0@
M<F]U=&EN97,@8V%N(’!R979E;G0@;W1H97()B*+RH@<’)O9W)A;7,@9G)O
M;2!E>&5C=71I;F<N(%1H:7,@<’)O9W)A;2!M=7-T(&)E(’)U;B!F;W(@86X@
M=6YK;F]W;@DJ+PHO
B!L96YG=&@@;V8@=&EM92 H-2!M:6YU=&5S(β€˜1O(#$@
M:&]U<BDN(%1R>2!T;R!S=&%R="!A;F]T:&5R"0DJ+PHOB!P<F]G<F%M(&%N
M9"!T:&4@;F5W(’!R;V=R86T@8V]U;&0@8W)A<V@)β€œ0D)β€œ0D)B*+RH@(" @
M(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @
M(" @(" @(" @(" @(" @(" J+PHO
B!4;R!C;VUP:6QE+”!Y;W4@;75S=”!L
M:6YK(’=I=&@@<&AR96YD97)?;β€œYL:6(N(”!&;W(@97AA;7!L93H@(" @(β€œHO
M"B\J(” @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @
M(" @(" @(" @(" @(" @(" @(" @(" @B*+RH@(&-C(β€œUW,R M;R!M96U?
M8W1X=%]B=6<@+6QP:’)E;F1E<E]S(β€œUL<&AO=&]N7W,@;65M7V-T>'1?8G5G
M+F,@(” @B*+RH)β€œ0D)β€œ0D)β€œ0D)β€œ0D)β€œ0D)β€œ2HO"B\J($]N8V4@<G5N;FEN
M9RP@8VQI8VL@;VX@=&AE(&)U='1O;B!T;R!S=&%R=”!A;B!I;F9I;FET92!L
M;V]P( D)B*+RH@=&AA="!A;β€˜1E<FYA=&5S(&)E=’=E96X@9’)A=VEN9R!A
M(&QI;F4@;VX@86YD(&]F9G-C<F5E;BX)"0DJ+PHO
B @(” @(” @(” @(” @
M(” @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @
M(" @(" @(β€œHO”@HC:6YC;'5D92 ;65M+F@^"B-I;F-L=61E(#QP:&]T;VXO
M4&A296YD97(N:#X
(VEN8VQU9&4@/%!T+F@^”@HO+R!4:&ES(’-I;7!L>2!D
M<F%W<R!A(&QI;F4L(&]N<V-R965N(&]R(&]F9B O+PIV;VED(&1I<W!L87E?
M;VYS8W)E96Y?;&EN92@I"GL
"5!H4F5C=%]T(’)E8W0@/2![(# L,β€œPR,# L
M,C P(β€˜T[β€œB @(”!09U-E=$9I;&Q#;VQO<B@@4&=?0DQ!0TL@3L"5!G1’)A
M=U)E8W0H)G)E8W0L4&=?1%)!5U]&24Q,3L(” @(%!G4V5T4W1R;VME0V]L
M;W(H(%!G7U=(251%(β€œD[β€œB @(”!09T1R87=)3&EN92@@,3,T+” Q,3$L(#$T
M-RP@,3(Y(β€œD[”@E09T9L=7-H
"D[β€œGT*β€œB\O('1H:7,@<F]U=&EN92!S971S
M('5P('1H92!O9F9S8W)E96X@:6UA9V4L(&-A;&QS(&1I<W!L87E?;VYS8W)E
M96Y?;&EN92 O+PHO+R!T;R!D<F%W('1H92!L:6YE(&EN=&@:70L(&%N9”!C
M;W!I97,@=&AE(&EM86=E(β€˜1O(’-C<F5E;B O+PIV;VED(&1I<W!L87E?;V9F
M<V-R965N7VQI;F4H0I[β€œB @(”!0:%!O:6YT7W0@(" @(" @(" @('1R86YS
M;&%T:6]N(#T@>R P+" P(β€˜T[β€œB @(”!0:$1I;5]T(" @("!D:6T@/2![(#(P
M,β€œP@,C P('T[β€œB @(”!0;4UE;6]R>4-O;G1E>'1?=” @(β€œIM8SL@β€œB @(”!S
M:&]R=” @(" @(" @(" @(" @(&)Y=&5S7W!E<E]P:7AE;" ](#$["@E0:%!O
M:6YT7W0@<&]S+’-I>F4[β€œB @(”!0:$EM86=E7W0@("!I;6%G93L
(” @( H@
M(" @;65M<V5T*" F:6UA9V4L(# L(’-I>F5O9BA0:$EM86=E7W0I(β€œD[”@EI
M;6%G92YT>7!E(#T@4&=?24U!1T5?4$%,151415]"651%.R O+R Q(&)Y=&4@
M<&5R(’!I>&5L(’=I=&@@=&AI<R!T>7!E"B @("!I;6%G92YS:7IE(#T@9&EM
M.PH@(" @:6UA9V4N:6UA9V4@/2!09U-H;65M0W)E871E*"!D:6TN=R J(&1I
M;2YH(β€œH@8GET97-?<&5R7W!I>&5L+”!.54Q,(β€œD[β€œB @(” (" @(&UC(#T@
M4&U-96U#<F5A=&5-0R@@)FEM86=E+" F9&EM+" F=’)A;G-L871I;VX@3L
M(" @( H@(" @4&U-96U3=&%R="@@;6,@3L"B\O+R\O+R\O+R\O+R\O+R\O
M+R\O+R\O+R\O+R\O+R\O+R*β€œ61I<W!L87E?;VYS8W)E96Y?;&EN92@I.PHO
M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O"B @(” (" @(%!M
M365M1FQU<V@H(&UC+" F:6UA9V4@3L@+R@9V5T('1H92!I;6%G90H@(" @
M4&U-96U3=&]P
"!M8R I.PH
"7!O<RYX(#T@<&]S+GD@/2 P.PH)<VEZ92YX
M(#T@<VEZ92YY(#T@,C P.PH)4&=$<F%W26UA9V4H:6UA9V4N:6UA9V4L4&=?
M24U!1T5?4$%,151415]β€œ651%+β€œ9P;W,L)G-I>F4L,C P+# I.PH@(” @”@E0
M9U-H;65M1&5S=’)O>2AI;6%G92YI;6%G92D[β€œB @(” O+R!N;W<@86QL(&1R
M87=I;F<@9V]E<R!T;R!T:&4@9&5F875L="!D<F%W:6YG(&-O;G1E>'0
(” @
M(%!M365M4F5L96%S94U#"!M8R I.PI]"@HO+R!T;V=G;&4@8G5T=&]N(&-A
M;&QB86-K.B!R97!E871E9&QY(&1R87<@;&EN92!O;B]O9F9S8W)E96X@+R*
M=F]I9"!B=71T;VY?8VQI8VME9"A0=%=I9&=E=%]T(β€œIW+”!V;VED(β€œIC;&EE
M;G1?9&%T82P@4’1#86QL8F%C:TEN9F]?=” J:6YF;RD
>PH)9F]R("@[.RD*
M"7L*β€œ0ED:7-P;&%Y7V]N<V-R965N7VQI;F4H3L"0ED:7-P;&%Y7V]F9G-C
M<F5E;E]L:6YE*β€œD[”@E]β€œGT*β€œFUA:6XH(&EN=”!A<F=C+”!C:&%R(β€œIA<F=V
M6UT@0I[β€œB @(”!0:$1I;5]T(" @("!D:6T@/2![(#(P,β€œP@,S P('T[β€œB @
M(”!0=$%R9U]T(” @("!A<F=;,3!=.PH@(" @4’17:61G971?=" @F)U=β€˜1O
M;BP@G=I;F1O=SL(" @(%!H07)E85]T(" @(&%R96$@/2![(#4P+" R-3 L
M(#@P+" T,"!].PH@(" @β€œB @(”!0=%-E=$%R9R@@)F%R9ULP72P@4’1?05)’
M7U=)3D1/5U]4251,12P@(DUE;6]R>2!#;VYT97AT(%-A;7!L92(L(# @3L
M(" @(%!T4V5T07)G
" F87)G6S%=+"!0=%]!4D=?1$E-+" F9&EM+" P(β€œD[
M"B @(”!0=%-E=$%R9R@@)F%R9ULR72P@4’1?05)β€˜7T9)3$Q?0T],3U(L(%!G
M7T=205DL(# @3L(" @(’=I;F1O=R ](%!T07!P26YI="@@3E5,3"P@)F%R
M9V,L(&%R9W8L(#,L(&%R9R I.PH
(” @(%!T4V5T07)G*” F87)G6S!=+"!0
M=%]!4D=?05)%02P@)F%R96$L(# @3L(" @(%!T4V5T07)G*" F87)G6S%=
M+"!0=%]!4D=?5$585%]35%))3D<L(")#;&EC:R!(97)E(BP@," I.PH@(" @
M8G5T=&]N(#T@4’1#<F5A=&57:61G970H(%!T0G5T=&]N+"!.54Q,+" R+"!A
M<F<@3L"5!T061D0V%L;&)A8VLH*%!T5VED9V5T7W0@BEB=71T;VXL4’1?
M0T)?04-4259!5$4L8G5T=&]N7V-L:6-K960L3E5,3"D["@H@(" @4’1296%L
J:7IE5VED9V5T
"!W:6YD;W<@3L"B @("!0=$UA:6Y,;V]P*"D["GT*
`
end