Problem uploading to Arduino Mega 2560

I have been trying to upload a sketch to my Mega 2560 for a while now. Earlier in the project this has not been a problem, but suddenly, the upload gets stuck and nothing happens, the loading bar is full, it says upload, and nothing happens for minutes or hours, until i compile again or shut down the IDE.
It verifies/compiles without problem, it uses only a little memory.

When i comment out the call to the function below, nothing changes, still cant upload, but when I comment out this entire function, I can.

void valveControl (struct group *group){
  if (group->nightControl){       //regulate waterflow periodically
    group->inTime = 0;
    for (int timeStampPointer = 0; timeStampPointer < 10; timeStampPointer++){   
      if (!(strcmp(group->timeStore[timeStampPointer], rtc.getTimeStr()))){
        group->inTime = 1;
        break;
      }
    }
    if (risingEdge(group->inTime, &(group->inTimeEdge))){         
      group->waterQue = 1;
    }
    if (group->waterQue){                             
      group->valveDurationStamp = millis();
      group->valveOpenNight = 1;
      group->waterQue = 0;
    }
    if (millis() - group->valveDurationStamp >= (group->valveOnSeconds * 1000)) {      
      group->valveOpenNight = 0;
    }
    group->valveOpen = group->valveOpenNight;                     
  }
  else{                       
    if (group->moisture < (group->moistSP - (group->hysteres / 2))){
      group->valveOpenCont = 1;
    }
    if (group->moisture > (group->moistSP + (group->hysteres / 2))){
      group->valveOpenCont = 0;
    }
    group->valveOpen = group->valveOpenCont;
  }
  return;
}

This function has worked before and the memory isn't full so does anyone have any idea how to solve this or at least how to approach the problem.

Thank you!

I have now tested to comment out everything related to or using the EEPROM library, and uncomment the function above along with it's function call, that too works. So, is it possible I have too much code? When I compile it says only 8% of program memory is used.

I have a scantime "watchdog" that posts the latest scantime on the Serial monitor, but that almost always equals the 10ms delay i have at the end of the void loop. Both when i run with the EEPROM or the above function commented out. So I can't see that the program should trigger any internal watchdogs, if there are any...