From: Josh C. <jc...@nc...> - 2008-04-10 21:46:51
|
On Thu, 10 Apr 2008, William S Fulton wrote: >>> With regard to memory leaks, I don't believe that is actually a >>> problem. No-one has complained about it. >> >> I hereby complain. I'm arguably abusing SWIG, but I use a full gigabyte >> in my SWIG runs. >> > Thanks for feedback. That is a lot of memory. Out of interest, how much > memory does g++/cl/whatever C++ compiler use when compiling the wrapper > file? Is it comparable to SWIG's usage in generating that wrapper file? Compiling with g++ 3.4 on 32-bit linux takes about the same amount of memory as SWIG. g++ 4.0 on 64-bit linux takes 4-5 times more. Of course g++ has more to do, even just in terms of code to parse; it parses all the headers that SWIG sees, plus a huge .cpp, which is several times bigger than the headers. >>> Ideally it would be nice to use less memory, but the only way >>> practical way to do this with DOH is to use a C++ garbage collector. >> >> I don't follow. If there are memory leaks because programmers neglect >> to delete (decrement the reference count) of DOH objects, then there are >> other ways to fix it. Smart pointers would be one. They would also >> make programming easier; no more worrying about decrementing reference >> counts, and more natural incrementing of reference counts. >> > I'm a fan of smart pointers. But in this project the core code is > currently written in C, so smart pointers are not an option. If I have > anything to do with a rewrite though, C will be out the window. I was suggesting introducing a smart pointer to DOH objects without taking anything away. Smart pointer use would of course be restricted to C++ code, but that seems to be where much of the action is, and it could be quite useful there. > There are lots of things we could improve, like move to c++, use the > stl, smart pointers etc, but it needs a concerted effort and as DOH is > used everywhere a big rewrite is needed. Right now we don't have enough > developers to fix the bugs in SF, which in my opinion is more important > than rewriting the internals. Sure, though more people might fix bugs if it were easier to do so. I'm not disagreeing with your judgement, just chiming in as a potential bug fixer. Thanks for all of your efforts. Josh |