Memory allocation in Windows error



I wrote a GTK-application in Linux and it works fine. I cross-compiled it with mingw and now I have it running on Windows XP too.

However under Windows I get some memory allocation errors which abort the program.In Linux no problems ...

I get this error mainly when I am loading a file from disk. The files are text-files saved by the program as well, inspection refeals that the files themselves are okay.The files vary in size and I have had larger files loaded okay, and then another small file fails.
(or when I read it for the third time for example !!)

I do not allocate memory in the program using g_malloc or malloc.

The error is:
Glib-ERROR: gmem.x:173: failed to allocate 32768 bytes aborting ...


By the way, I blanked out the line #define malloc rpl_malloc in the config.h I use with the automake because otherwise mingw does not compile. But this should have no consequence because I don't use malloc, correct ?

Does anybody experience similar problems with Windows and what is a solution?

How can I allocate enough memory on prehand so to avoid an abort ?

P.S. My code now is pretty staight-forward, like in the textbooks:

FILE *fp;
gchar c;
fp = fopen("filename","r");
while ((c=getc(fp))!=EOF)
{

 read etc...

}


Thank you in advance for your reaction,
Edward




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]