Uploading big sketch fails

Hi everyone, first of all, I'd like you to excuse my poor english.

I'm the happy owner of a Sainsmart mega 2560 with an mega8u2 chip.
I got able to upload sketch to it without any problems except for now, I've seen that the upload fail every time the sketch is bigger than 47 000 bytes. I have no ideas what is the problem. I've checked the firmware of the mega8u2 which seems to up to date. If any of you have gotten this problem I'd really appreciate an explanation and why not a solution.
Thank you in advance,

-A

This problem with mega2560 was discussed here, I think. Just search.

Sorry for that, I looked up on google with no result. I'll try here thanks

Edit: Well, no I havent found answers to my problem.
I don't get any error message, the upload just get stuck at the end,
I do not use Serial command a lot in the sketch but I do use a lot the lcd screen functions.

Finally I found one http://forum.arduino.cc/index.php?topic=60960.0. Maybe it helps.

Thanks a lot for the time,
I've seen this post and the progmem solution, but from what I've seen, but I don't feel I use a lot of RAM, most of the code I use is controlling a TFT screen, I don't know how I could reduce it by using progmem. I'll check but I don't think I have more than 10 variables.

Did you try IDE 1.5.7 or higher? It has a newer version of avrdude which may make a difference for the upload. It also has a newer version of gcc which you will want too.

If that doesn't help, switch on verbose output during upload and post the output here. I wonder at what point the upload stops.

Just tried some things out as a reference. I have here an 100KB sketch that I uploaded to a mega 2560.
ide 1.5.7: compiles ok - uploads ok
ide 1.0.6: does not compile, it seems to miss pgm_get_far_address()
ide 1.0.6, combined with the toolchain from 1.5.7, i.e. avr-gcc 4.8.1: compiles ok, uploads ok.

I would certainly go for the newer avr-gcc.

This has also been discussed within the past year or so, especially in regards using the PROGMEM attribute, and something to do with the bootloader. I can't find the thread(s), but you might search some more including "westfw", the main bootloader guy, as a search term. Myself and others have successfully tried loading sketches up to > 100KB and using IDE v1.0.5.

I found one:
http://forum.arduino.cc/index.php?topic=52254.0

Sorry; I don't do the 2560 bootloader, and it's significantly different from the Uno bootloader.
Are you running into the triple-exclamation-point bug? ("!!!")