Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Ethereal-dev: [Ethereal-dev] G_malloc vs malloc

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "Ceyhun Seran" <sceyhun@xxxxxxxxxx>
Date: Thu, 13 Oct 2005 15:32:58 +0200
Title: G_malloc vs malloc

Hi,

To avoid usage of g_malloc() which results crashes in ethereal, I replaced all g_malloc() (about 3000 occurences) by malloc and g_malloc0() by calloc. Because when the memory is allocated by a g_malloc, it is not returned to system by calling g_free() and stays in application free memory heap. The problem is, if this free memory is tried to be allocated by another g_malloc(), ethereal crashes. (write error)

By replacing g_malloc() by malloc(), when the used memory is returned to system by free(), the memory can be reallocated by another malloc() call which doesn't crash ethereal…

Could you confirm this result? And my question is :
why didn't you limit the usage of g_malloc() or why didn't you replace all g_malloc() by another suitable memory allocation function in actual release?

Regards,
 
Ceyhun SERAN
Nortel Networks
E2E Engineering Solutions