views:

31

answers:

1

Hi, I'm practicing drawing polyline on the Map. I've adopted Sample code from download here.

Here is the part that I got memory warning when I do build->Analysis

 MKMapRect routeRect = MKMapRectMake(southWestPoint.x, southWestPoint.y, northEastPoint.x - southWestPoint.x, northEastPoint.y - southWestPoint.y);
// clear the memory allocated earlier for the points
free(pointArr);

Debugger Window prompt error

The left operand of '-' is a garbage value

Uhm I don't get it. Why is this happened?

Is this Critical Error?

How to fix it?

Thank you.

+1  A: 

The variable northEastPoint has apparently not been initialized to anything. This means that your calculation will almost certainly not return whatever value you were hoping for. You fix it by initializing all your variables to a meaningful state.

Chuck