Q:

Presence of a Function Breaks HTTP Requests

So I have some code written for an Arduino that basically only makes HTTP requests. It's a Twitter project, but most of the Twitter information is gathered via a PHP script. The Arduino only serves to gather small bits of text from text files and tweet based on their contents. These include one file for the number of followers (tweet if it's changed), last mention date (tweet if it's changed), and newest follower name (used in the follower tweet to mention the user).
I wrote the function getLastFollowerName() to get the name of the last follower. It does the same action as the functions checkMentions() and 'checkFollowers()`. However, something strange happens with this function. As soon as I implemented it, the test runs went as follows.

All but two of the characters in the username contained in followedBy.txt were obtained, then the Arduino code stopped dead.
Same as 1.
HTTP request in getLastFollowerName() could not find the two \r\n characters, implying that they were finding some other form of response that they shouldn't have been. In printing this response, it started printing an entire HTML document header (DOCTYPE, etc.) which is nonsense since I'm requesting a text file.
All other HTTP requests (in checkMentions() and checkFollowers()) began to misbehave the same way that the getLastFollowerName() request did in 3.

All subsequent runs have been as described in 4. So I commented out the function call for getLastFollowerName() and nothing changed. I commented out the code itself for the function, and everything began to work as it did before I added the function.
So my question is - what about that function might be breaking the HTTP requests just by being present, even when it's not being called? Is it the code itself, or more likely the size of the function somehow? If the latter, how exactly do I go about fixing this if I need that function in there?
EDIT: Sorry, forgot to paste the code. Here it is (removed some sensitive information (WiFi info, Twitter key, etc.)
#include <SPI.h>
#include <WiFi.h>
#include <Twitter.h>

int led = 9; //put at 9 and GND

char ssid[] = ""; //  your network SSID (name) 
char pass[] = "";    // your network password (use for WPA, or use as key for WEP)

int keyIndex = 0;            // your network key Index number (needed only for WEP)

int status = WL_IDLE_STATUS; // status of the wifi connection

// initialize the library instance:
WiFiClient client;

const unsigned long requestInterval = 30*1000;    // delay between requests; 30 seconds

// if you don't want to use DNS (and reduce your sketch size)
// use the numeric IP instead of the name for the server:
//IPAddress server(199,59,149,200);    // numeric IP for api.twitter.com
char server[] = "mysite.com";     // name address for twitter API

boolean requested;                     // whether you've made a request since connecting
unsigned long lastAttemptTime = 0;     // last time you connected to the server, in milliseconds

Twitter twitter(""); //token authorized from (you do NOT need to reobtain this) 

String lastCount = ""; //last number counted
String lastDate = "";
String lastFollower="";

unsigned long startTime;
const unsigned long connectTimeout = 15L * 1000L; // Max time to retry server link
int numberOfBytes=0;

void setup()
{
  // reserve space for the strings:
//  tweet.reserve(150);
  //Initialize serial and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }

  // check for the presence of the shield:
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present"); 
    // don't continue:
    while(true);
  } 

  // attempt to connect to Wifi network:
  while ( status != WL_CONNECTED) { 
    Serial.print("Attempting to connect to SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:    
    status = WiFi.begin(ssid, pass);

    // wait 10 seconds for connection:
    delay(5000);
    //delay(10000);
    //tweet("this is another test");
  }
}

void loop()
{
  while(!checkFollowers()); //keep trying until successful
  client.stop();
  while(!checkMentions()); //keep trying until successful
  client.stop();
}

boolean checkFollowers()
{
  //connectToServer();
  //delay(10000);
  String currentLine="";
  currentLine.reserve(256);
  if (client.connected())
  {
    Serial.println("Connected. Checking for availabilty of client...");
    if (client.available())
    {
      Serial.println("Client is available! Trying to read from client...");
      // read incoming bytes:

      if(client.find("\r\n\r\n"))
      {

      char inChar;
      while(inChar=client.read())
      {
        if(inChar==-1) break;
        currentLine+=inChar; //read in all characters of count
        Serial.print("\n\nCurrent follower count: " + currentLine + "\n\n");
        //if(inChar=='y' || inChar == 'n') break;
      }
      if(currentLine!=lastCount)
      //if(inChar=='y')
      {
        lastCount=currentLine;

//        while(getLastFollowerName())
//        {
//          Serial.println("follower name not yet found");
//        }
        //client.stop();
        //char finalTweet[170];
        //int n = sprintf(finalTweet, "%s%s", lastFollower, " Thanks for the follow!");
        tweet("Thanks for the tweet!");
        Serial.println("BLINKING LED");
        blink(3);
      }
      else
      {
        Serial.println("NOT BLINKING.");
        tweet("Someone should follow me!");
      }
      currentLine=""; //clear
      delay(5000); //delay 5 seconds (don't kill server)
      return true;
     }
     else
     {
       Serial.println("newlines not found - error with request");
       return false;
     }
    }
    else
    {
      Serial.println("followers not available");
      return false;
    }
  }
  else if (millis() - lastAttemptTime > requestInterval)
  {
    // if you're not connected, and two minutes have passed since
    // your last connection, then attempt to connect again:
    //runPhpScript(); //try to run PHP script to get latest info
    //connectToServer();
    makeHttpRequest("/private/followerScript.php");
    client.stop(); //cut connection after running script (I think this is what this does...)
    makeHttpRequest("/private/followerCount.txt");
    return false;
  }
  else
  {
    //Serial.print("f");
    return false;
  }
}

boolean checkMentions()
{
  String currentLine="";
  if (client.connected())
  {
    Serial.println("Connected. Checking for availabilty of client...");
    if (client.available())
    {
      Serial.println("Client is available! Trying to read from client...");
      // read incoming bytes:

      if(client.find("\r\n\r\n"))
      {

      char inChar;

//      inChar = client.read(); //read in a character
      while(inChar=client.read())
      {
        if(inChar==-1) break;
        currentLine+=inChar; //read in all characters of count
        Serial.print("\n\nCurrent mention date: " + currentLine + "\n\n");
      }
      if(currentLine!=lastDate)
      {
        lastDate=currentLine;
        Serial.println("BLINKING LED");
        tweet("Someone just mentioned me!");
        blink(3);
      }
      else
      {
        Serial.println("NOT BLINKING.");
        tweet("Someone should mention me!");
      }
      currentLine=""; //clear
      delay(5000); //delay 5 seconds (don't kill server)
      return true;
     }
     else
     {
       Serial.println("newlines not found - error with request");
       return false;
     }
    }
    else
    {
      Serial.println("mentions - not available");
      return false;
    }

  }
  else if (millis() - lastAttemptTime > requestInterval)
  {
    // if you're not connected, and two minutes have passed since
    // your last connection, then attempt to connect again:
    makeHttpRequest("/private/mentionScript.php");
    client.stop();
    makeHttpRequest("/private/mentionsDate.txt");
    return false;
  }
  else
  {
    //Serial.print("m");
    return false;
  }
}

boolean getLastFollowerName()
{
  String currentLine="";
  if (client.connected())
  {
    //Serial.println("Connected. Checking for availabilty of client...");
    if (client.available())
    {
      Serial.println("Trying to read last follower name...");

      if(client.find("\r\n\r\n"))
      {

      char inChar;

      while(inChar=client.read())
      {
        if(inChar==-1) break;
        currentLine+=inChar; //read in all characters of count
        Serial.print("\n\nLast follower: " + currentLine + "\n\n");
      }
      lastFollower = currentLine; //store globally
      return true;
     }
     else
     {
       Serial.println("newlines not found - error with request");
       return false;
     }
    }
    else
    {
      return false;
    }
    return false;
  }
  else if (millis() - lastAttemptTime > requestInterval)
  {
    makeHttpRequest("/private/followedBy.txt");

    Serial.println("making HTTP request to followed by cache file");
    return false;
  }
  else
  {
    return false;
  }
}

void blink(int blinkCount) //blink specified number of times
{
  for(int i = 0; i < blinkCount; i++)
  {
    for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5)
    { 
    // sets the value (range from 0 to 255):
      analogWrite(led, fadeValue);         
      // wait for 30 milliseconds to see the dimming effect    
      delay(40);                            
    } 

  // fade out from max to min in increments of 5 points:
    for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5)
    { 
      // sets the value (range from 0 to 255):
      analogWrite(led, fadeValue);         
      // wait for 30 milliseconds to see the dimming effect    
      delay(40);                            
    } 
  //digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  //delay(3000);               // wait for a second
  //digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  //delay(1000);               // wait for a second
  }
}

void makeHttpRequest(String url)
{
  // attempt to connect, and wait a millisecond:
  Serial.println("connecting to server...");
  if (client.connect(server, 80))
  {
    Serial.println("making HTTP request to " + url + " ...");
    // make HTTP GET request to twitter:
    client.println("GET " + url + " HTTP/1.1");
    client.println("Host:mysite.com");
    client.println("Connection:close");
    client.println();
  }
  else
  {
    Serial.println("Failure to connect.");
  }
  // note the time of this connect attempt:
  lastAttemptTime = millis();
}

void tweet(char givenTweet[])
{
  //start CLIENT code
  startTime = millis();
  char hashtag[] = "#hashtag";

  char tweet[170];
  int n=sprintf(tweet, "%s%s", givenTweet, hashtag);

  while((client.connect(server, 80) == false) &&
    ((millis() - startTime) < connectTimeout));

    if(client.connected())  // Success!
    {
      Serial.println("\nClient connected to server, ready to tweet!!!");

      if (twitter.post(tweet))
      {
        int status = twitter.wait(&Serial);
        if (status == 200) //this doesn't happen for some reason
        {
             Serial.println("\nTweet Successful: OK.\n");  
        }
        else
        {
            Serial.print("\nTweet Failed : code ");
            //Serial.println(status);
        }
      }
      else
      {
          int statusNum = twitter.wait(&Serial);
          Serial.println("\nConnection to Twitter failed.\n");
          if(statusNum==0) //should always be
            Serial.println("No status number returned.");
       }
      client.stop();
  }

}

A:

Almost sure you are out of ram. See http://playground.arduino.cc/Code/AvailableMemory

