EthernetDHCP lib, conflict with code

Hello. So I have some project.
Here is snippet of code with DHCP using

  Serial.println("Attempting to obtain a DHCP lease...");

  EthernetDHCP.begin(mac);

  const byte* ipAddr = EthernetDHCP.ipAddress();
  const byte* gatewayAddr = EthernetDHCP.gatewayIpAddress();
  const byte* dnsAddr = EthernetDHCP.dnsIpAddress();

  Serial.println("A DHCP lease has been obtained.");

  Serial.print("My IP address is ");
  Serial.println(ip_to_str(ipAddr));

  Serial.print("Gateway IP address is ");
  Serial.println(ip_to_str(gatewayAddr));

  Serial.print("DNS IP address is ");
  Serial.println(ip_to_str(dnsAddr));

It is working normal, but when i add definition of following function

float GetTemp()
{
  byte present = 0;
  byte data[12];
  byte addr[8];
  byte E_NoAddress = 201;
  byte E_WrongCRC = 202;
  byte E_InvalidDevice = 203;

  if ( !ds1820.search(addr)) {
    Serial.print("No more addresses.\n");
    ds1820.reset_search();
    return E_NoAddress;
  }

  Serial.print("R=");
  for(byte i = 0; i < 8; i++) {
    Serial.print(addr[i], HEX);
    Serial.print(" ");
  }

  if ( OneWire::crc8( addr, 7) != addr[7]) {
    Serial.print("CRC is not valid!\n");
    return E_WrongCRC;
  }

  if ( addr[0] != 0x10) {
    Serial.print("Device is not a DS18S20 family device.\n");
    return E_InvalidDevice;
  }

  Serial.println("Starting conversion");
  ds1820.reset();
  ds1820.select(addr);
  ds1820.write(0x44);         
  
  delay(1000);     
  
  Serial.println("Conversion completed, reading RAM...");
  present = ds1820.reset();
  ds1820.select(addr);    
  ds1820.write(0xBE);  

  for (byte i = 0; i < 9; i++)          
    data[i] = ds1820.read();

  Serial.println("Data transmitted, processing...");

  int HighByte, LowByte, TReading,SignBit,Whole,Fract,Tc_100;
  float ret_val;
  LowByte = data[0];
  HighByte = data[1];

  TReading = (HighByte << 8) + LowByte; 

  SignBit = TReading & 0x8000;  // test most sig bit
  if (SignBit) // negative
  {
    TReading = (TReading ^ 0xffff) + 1; // 2's comp
  }
  Tc_100 = (TReading*100/2);    

  Whole = Tc_100 / 100;  // separate off the whole and fractional portions
  Fract = Tc_100 % 100;
  ret_val = Whole + Fract / 100;

  Serial.print(" T = ");
  if (SignBit)
  {
    Serial.print("-");
    ret_val = - ret_val;
  }
  Serial.print(Whole);
  Serial.print(".");
  if (Fract < 10) 
    Serial.print("0");
  Serial.print(Fract);
  Serial.println();

  return ret_val;
}

DHCP hanging on EthernetDHCP.begin(mac);
The strangest thing that i only define fuinction "GetTemp" not using it anywhere in the code.

Some addings.

  1. This function tested with simply Ethernet library and static IP, and was working normally.

  2. I've tried to localize bad code but find out such thing

float GetTemp()
{
  byte present = 0;
  byte addr[8];    


  byte data[12];

  byte E_NoAddress = 201;
  byte E_WrongCRC = 202;
  byte E_InvalidDevice = 203;

  if ( !ds1820.search(addr)) {
    Serial.print("No more addresses.\n");
    ds1820.reset_search();
    return E_NoAddress;
  }

  if ( OneWire::crc8( addr, 7) != addr[7]) {
    Serial.print("CRC is not valid!\n");
    return E_WrongCRC;
  }
  if ( addr[0] != 0x10) {
    Serial.print("Device is not a DS18S20 family device.\n");
    return E_InvalidDevice;
  }

  Serial.println("Starting conversion");
  ds1820.reset();
  ds1820.select(addr);
  ds1820.write(0x44); 

  delay(1000);     

  Serial.println("Conversion completed, reading RAM...");
  present = ds1820.reset();
  ds1820.select(addr);    
  ds1820.write(0xBE); 

  return 0;
}

This is a minimum of code, when nothing working. If i cut pair strings of code, no matter from where, everything comes back to work. =/

What Arduino are you running this on? You have a lot of code, and a lot of variables just in the snippet shown. There are a lot more variables and arrays used by the libraries that you are using.

I suspect that you are running out of memory.

Search the forum for "FreeMemory", and add a function to report how much memory is available, in both sketches. Post the results.

Thank you, for your reply.
The problem was in the free space amount, as you assumed.

I've run FreeMemory function at the setup() routine. And find only about 200bytes SRAM free. Apparently it doesn't enough for DHCP. So I move some string constants to PROGMEM, and free memory amount raised up to about 800bytes, and all is working now.