Re: Memory allocation in Windows error





Tor Lillqvist wrote:
edward hage writes:
 > I wrote a GTK-application in Linux and it works fine.

That might just be a coincidence, it might *seem* to work fine, with
some input data. Have you run it under valgrind on Linux?

I never tried valgrind, I have it on my computer so just used it.
I don't understand all the lingo it outputs on the screen, but the moment I pushed the okay button for loading a file indeed more than 30,000 errors, so valgrind just stopped with its output. Okay, I can't blame the program.

It's output:
==22808== Conditional jump or move depends on uninitialised value(s)
==22808==    at 0x806110D: DetermineSetpointXandV (generate_setpoint.c:295)
==22808==    by 0x80507F2: Create_profiles (calculate.c:753)
==22808==    by 0x8051068: Calculate_moves_and_forces (calculate.c:850)
==22808==    by 0x80546F7: toolbar_start_calculate (menus.c:471)
==22808==
==22808== Invalid write of size 1
==22808==    at 0x8064819: Load_data_from_file (loadcase.c:222)
==22808==    by 0x8064C2A: fileopen_callback (loadcase.c:135)
==22808==    by 0x406457C0: g_cclosure_marshal_VOID__VOID (gmarshal.c:77)
==22808==    by 0x40636DAA: g_closure_invoke (gclosure.c:437)
==22808==    Address 0x424A4168 is 0 bytes after a block of size 4 alloc'd
==22808==    at 0x40027CB4: malloc (in /usr/lib/valgrind/vgskin_memcheck.so)
==22808==    by 0x4069B0B6: g_malloc (gmem.c:136)
==22808==    by 0x8064649: Load_data_from_file (loadcase.c:173)
==22808==    by 0x8064C2A: fileopen_callback (loadcase.c:135)
==22808==
==22808== Invalid read of size 1
==22808==    at 0x40720AD0: __GI_____strtod_l_internal (in /lib/libc.so.6)
==22808==    by 0x4071D860: __GI___strtod_internal (in /lib/libc.so.6)
==22808==    by 0x80649D1: Load_data_from_file (stdlib.h:311)
==22808==    by 0x8064C2A: fileopen_callback (loadcase.c:135)
==22808==    Address 0x424A4168 is 0 bytes after a block of size 4 alloc'd
==22808==    at 0x40027CB4: malloc (in /usr/lib/valgrind/vgskin_memcheck.so)
==22808==    by 0x4069B0B6: g_malloc (gmem.c:136)
==22808==    by 0x8064649: Load_data_from_file (loadcase.c:173)
==22808==    by 0x8064C2A: fileopen_callback (loadcase.c:135)

The Invalid read of size 1 occures 30000 times.I try to find out what happens here.

I will try to find on the web where I can find a clear tutorial of valgrind (no manpage is supplied). If anybody has suggestions for a tutorial I am interested !!


 > because I don't use malloc, correct ?

But do you use any of the GLib memory handling functions, like
g_malloc(), g_new(), g_free()?

Yes, I use g_malloc for almost every pointer and GArray I define. Also in the function in which I read the file. I know I don't consequently have a g_free for every g_malloc, but I didn't experience any problems with it (or better: I didn't realise the problems I have with it).

Thank you for the info.
Edward




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