Pealing the Onion - Serial monitor causes computer to crash again

On my previous thread Program locks computer (DONT RUN) - Programming Questions - Arduino Forum I got help for a sketch that was causing my Mac OSX to lock up when I used the serial monitor. I used one of the suggestions and added a delay function to slow the Serial.println commands from bombarding the computer. This worked. Thinking that was the solution I made another sketch using this technique to further debug (pealing back the onion 8) ) a larger sketch and am still getting a crashing issue.

I am finding that variable result2 in my larger sketch is not being passed correctly in the function Compute1 for some reason so I made this smaller sketch below to find out what is going on. Problem is, this sketch completely locks up my computer (OSX Mavericks) running Arduino IDE's Serial Monitor on an Uno (Atmega328p). Any ideas what I am doing wrong? The Computer isn't running anything else but the Arduino IDE when this happens btw.

debug sketch:

#include <F1.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <Arduino.h>

volatile uint8_t a1=255;
const uint16_t Const1=392;
F1Class f1_object;
volatile uint8_t array1[Const1+2];

void setup(){
  Serial.begin(115200); // 10MHz xtal and UBRR of 0  
  Serial.write("Here we go...\n");

}

void loop() {
uint32_t a2=1;
uint8_t a3=16;

  a2=f1_object.Compute1(Const1,array1,a1,a3);

  delay(1000);
  //Serial.write("loop result = ");
  //Serial.println(a2);
}

F1.cpp:

#include "F1.h"

F1Class::F1Class(){
}

uint32_t F1Class::Compute1(const uint16_t Const2,volatile uint8_t arrray2[],volatile uint8_t a3, uint8_t& _a4){

    uint32_t _result1=1;
    float _result2=1;

   _result2=Compute3(Const2, arrray2, a3);
//Serial.println(_result2,8);
    
	return _result1;
}


float F1Class::Compute2(uint32_t array3[], uint8_t _b3,const uint16_t Const2) {
    
    static prog_uint32_t PROGMEM  MAX_U32=4294967200;
    float floatResult1=1.0;
    
    uint32_t _b1=pgm_read_dword(&MAX_U32);
    uint8_t _b2=_b3;

    for (uint8_t _index1=_b3; _index1<(Const2/2); _index1++) {
    
        if (array3[_index1]<_b1) {
            _b1=array3[_index1];
            _b2=_index1;
        }
    }

    return floatResult1;
}

float F1Class::Compute3(const uint16_t Const2,volatile uint8_t arrray2[],volatile uint8_t a3) {
    uint32_t array3[] = {
        187450	,
        187451	,
        187452	,
        187453	,
        187454	,
        187455	,
        267996	,
        362019	,
        468979	,
        588465	,
        719973	,
        863096	,
        1017143	,
        1181663	,
        1356058	,
        1539698	,
        1732110	,
        1932654	,
        2140650	,
        2355609	,
        2576829	,
        2803835	,
        3035951	,
        3272395	,
        3512963	,
        3756688	,
        4003376	,
        4252000	,
        4502133	,
        4753302	,
        5005084	,
        5256466	,
        5507031	,
        5756334	,
        6003996	,
        6249596	,
        6492193	,
        6731376	,
        6967075	,
        7198369	,
        7424901	,
        7646358	,
        7862395	,
        8072165	,
        8275887	,
        8472790	,
        8662324	,
        8844170	,
        9018131	,
        9183735	,
        9340685	,
        9488830	,
        9627298	,
        9756113	,
        9875056	,
        9983873	,
        10082116	,
        10169587	,
        10246121	,
        10311450	,
        10365543	,
        10408007	,
        10438839	,
        10457885	,
        10465005	,
        10460148	,
        10443209	,
        10414166	,
        10373005	,
        10319752	,
        10254412	,
        10177177	,
        10088092	,
        9987384	,
        9875130	,
        9751516	,
        9616887	,
        9471499	,
        9315487	,
        9149300	,
        8973458	,
        8788109	,
        8593871	,
        8390894	,
        8180055	,
        7961692	,
        7736182	,
        7504313	,
        7266488	,
        7023559	,
        6775958	,
        6524321	,
        6269337	,
        6011817	,
        5752305	,
        5491546	,
        5230092	,
        4968774	,
        4708152	,
        4448969	,
        4192018	,
        3937859	,
        3687203	,
        3440811	,
        3198952	,
        2962785	,
        2732535	,
        2508881	,
        2292259	,
        2083264	,
        1882274	,
        1689868	,
        1506543	,
        1332587	,
        1168284	,
        1014061	,
        870273	,
        737076	,
        614640	,
        503196	,
        402834	,
        313701	,
        235732	,
        169000	,
        113473	,
        69130	,
        35824	,
        13464	,
        1903	,
        902	,
        10255	,
        29714	,
        59039	,
        97883	,
        145961	,
        202860	,
        268293	,
        341872	,
        423312	,
        512106	,
        607810	,
        710105	,
        818549	,
        932666	,
        1051970	,
        1176152	,
        1304708	,
        1437343	,
        1573583	,
        1712906	,
        1854792	,
        1999193	,
        2145625	,
        2293594	,
        2442815	,
        2592802	,
        2743342	,
        2893935	,
        3044354	,
        3194432	,
        3343376	,
        3491292	,
        3638035	,
        3782854	,
        3925859	,
        4066975	,
        4205439	,
        4341162	,
        4473981	,
        4603849	,
        4730031	,
        4852717	,
        4971870	,
        5087134	,
        5197838	,
        5304487	,
        5406460	,
        5503730	,
        5596009	,
        5683180	,
        5765081	,
        5841599	,
        5912641	,
        5977818	,
        6037147	,
        6090302	,
        6137310	,
        6177874	,
        6212138	,
        6239733	,
        6260706	,
        6274785	,
        6281998	,
        6282239	,
        6275446	,
        6261541	,
        6240463
    };
    uint8_t _b3=5;
    float c1;

    c1=Compute2(array3, _b3, Const2);
    //Serial.println(c1,8);
    
    return c1;
}

F1.h:

#ifndef X_H
#define X_H

#include <avr/pgmspace.h>
#include <Arduino.h>


class F1Class
{

public:
	F1Class();
    // Members
	uint32_t Compute1(const uint16_t Const2,volatile uint8_t arrray2[],volatile uint8_t a3, uint8_t& _a4);
    
private:
    // Members
    float Compute3(const uint16_t Const2,volatile uint8_t arrray2[],volatile uint8_t a3);
    float Compute2(uint32_t array3[], uint8_t _b3,const uint16_t Const2);

};

#endif

Have you checked out how much free memory you have on the Arduino when these various sketches are running?

I think you should figure out your issues with PROGMEM outside of a class.

Though, I can't imagine why the Arduino is causing the Mac to have problems.

PaulS:
I think you should figure out your issues with PROGMEM outside of a class.

Could you explain what you mean by that?

Thanks

Why have you started a new Thread for the same problem?

Ask the moderator to merge this with your other Thread, otherwise it is just too confusing.

...R

Robin2:
Why have you started a new Thread for the same problem?

Ask the moderator to merge this with your other Thread, otherwise it is just too confusing.

...R

I thought the code and the solution (which will have to be different) warranted it. However, based on your feedback I have reconsidered and I have sent a moderator request to merge

Sorry for the inconvenience

I'm not sure which thread to respond to now, but I think you need to simplify the 'simple' case even further and get rid of the functions, and the classes, and the progmem. The only thing that ought to be affecting the PC is what's printed to the serial port, so you ought to be able to produce identical behaviour by simply printing the same byte sequence directly without all that extra code involved. Can you?