[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    RFC: Proper destruction of static data?
From:       Werner Trobin <wtrobin () mandrakesoft ! com>
Date:       2000-06-27 19:16:26
[Download RAW message or body]

Hi (Michael :)!

After some bug-hunting and discussions on IRC we (Waldo
and I) came to the conclusion that static objects are evil
in DSOs, because they can lead to unexpected behavior
(crashes :) or at least mem leaks on unloading.

Therefore we thought about some ways to solve that problem.
We didn't find a "clean" and easy way, but I want to explain
one possible solution which involves some am_edit & Co.
magic... I hope that you can come up with better/cleaner
ways to solve that problem :)

We #define KSTATIC static and let some magic tool look
for KSTATIC in the sources. It extracts all the variable
names (only static pointers to objects are allowed) and
creates a "clean up" function. This function deletes all
the objects when the lib gets unloaded...

Am I completely wrong? Do I miss something important?
Comments, suggestions, flames...?

-- 
Werner Trobin - wtrobin@mandrakesoft.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic