> There are many inconsistencies in memory allocation usage. Memory is
> often allocated with malloc() and deallocated with g_free() or the
> inverse. Is someone currently looking at this or should I submit a patch
> (convert everything to glib), which represents many files?

I just did a quick search for everything using free() in 0.17.x (since
that branch uses glib, and there's only a handful of free() calls) and
found that EVERYTHING that calls free() is allocated with malloc().

I then checked for things that call malloc() and made sure that everything
that uses malloc() is freed with free().   I found only one place where
that happened (in telnetstr.c).

I've committed that change to CVS.

>
> In my environment, I get an assert on each misuse, which is quite
> bothering and is normal though since this is a Bad Thing.
>

Please make sure that you're not mixing files between 0.16.x branch and
0.17.x branch.  There should be no g_malloc() or g_free() on the 0.16
branch.   On the 0.17 branch, everything that's malloc() should be free()
and everything that's g_malloc() should be g_free(), at least in CVS.

> I wonder why nobody cared before?

Because g_free just calls free, behind the covers?   and g_malloc just
calls malloc() behind the covers?   So, you wouldn't even notice the
difference, unless you turned glib's memory profiling on?

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.