Are GHashTable's deterministic?



Hi,

I'm using GHashTable's and I came accross a "curious" behavior. Changing
the code size of my program (i.e. adding some functions) changed the
behavior of the program (the new functions never being called). The
first reaction is obviously to look for stack corruption and related
symptoms. After a few hours (days?) of careful debuging, purifying and
such, I realized that the difference in behavior was actually caused by
a call to g_hash_table_foreach. What happened was that when the code
size changed, the order in which items were stored in the GHashTable
changed and g_hash_table_foreach did not step through items in the same
order thus generating a different behavior.

Is this the real explanation?

If this is, it is quite annoying because it leads to a behavior
depending on the code size. When debuging, adding code will then lead to
unreproductible behavior. Is there a solution to this problem?

Thanks a lot for any comment.

Stéphane Popinet



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