<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12">
<TITLE>VM crash</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>Hi all,</FONT>
</P>

<P><FONT SIZE=2>I do hope someone can help me out here because it's a real stopper for my app. I was getting sporadic VM crashes when calling my plugin, which I have now got down to a very small subset of code to reproduce the problem. The crash dump never has a stack trace and sometimes it fails so bad no dump is produced. Essentially what I have is a 'C' method that returns and array of 4096 float values. I have taken away all the application C code and simply load and return an array, so I am quite sure it's not the C code that's breaking but somewhere in the C/Squeak interface. Here is what I have (stripped to minimum for clarity). For testing I am running this flat out in a loop. If I run 100,000 iterations I will usually but not always get a crash. Is there anything I can do to isolate this a bit further?</FONT></P>

<P><FONT SIZE=2>Thanks in advance for any help.</FONT>
</P>

<P><FONT SIZE=2>Bob</FONT>
</P>

<P><FONT SIZE=2>The C code:</FONT>
<BR><FONT SIZE=2>-----------</FONT>
</P>

<P><FONT SIZE=2>void process_test(float *results) {</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>float a[4096];</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>int i;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>float f = 0.0;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>for(i=0;i&lt;4096;i++){</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>a[i] = f;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>f = f + 1.0;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>}</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>memcpy((void *)results, a, 4096*sizeof(float));</FONT>
<BR><FONT SIZE=2>}</FONT>
</P>

<P><FONT SIZE=2>The plugin code which is translated and compiled with the C code:</FONT>
<BR><FONT SIZE=2>----------------</FONT>
</P>

<P><FONT SIZE=2>test: data</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>self export: true.</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>self &nbsp;&nbsp; primitive: 'test'</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>parameters:#(FloatArray).</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>(self cCode: 'process_test(data)').</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>^data.</FONT>
</P>

<P><FONT SIZE=2>The calling code:</FONT>
<BR><FONT SIZE=2>-----------------</FONT>
</P>

<P><FONT SIZE=2>primTest: data</FONT>
<BR><FONT SIZE=2>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;primitive: 'test' module:'SDRDttSpDSPPlugin'&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>Transcript show: 'Primitive Test failed'.</FONT>
<BR><FONT SIZE=2>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ^ false</FONT>
</P>

<P><FONT SIZE=2>Finally, the method I call:</FONT>
<BR><FONT SIZE=2>------------------</FONT>
</P>

<P><FONT SIZE=2>test</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>|data|</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>data := FloatArray new: 4096.</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>self primTest: data.</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>^ data.</FONT>
</P>


<P><STRONG>*** Confidentiality Notice ***</STRONG> 
Proprietary/Confidential<BR>Information belonging to CGI Group Inc. and its 
affiliates<BR>may be contained in this message. If you are not a 
recipient<BR>indicated or intended in this message (or responsible 
for<BR>delivery of this message to such person), or you think for<BR>any reason 
that this message may have been addressed to you<BR>in error, you may not use or 
copy or deliver this message<BR>to anyone else.&nbsp; In such case, you should 
destroy this<BR>message and are asked to notify the sender by reply 
email.</P>
</BODY>
</HTML>