5 ms·
You are wrong. I made a comment to that effect higher up before noticing this. When you're dealing with real world data - timings, statistics, sizes, dates, a
by oppositelock 12y ago
You are wrong.
I made a comment to that effect higher up before noticing this.
When you're dealing with real world data - timings, statistics, sizes, dates, and then if you add floating point numbers whose representations look like big ints, you will be hitting this a lot, and leaking memory, due to how your mark and sweep works.
It is absolutely critical to have a sure way of disambiguating pointers from data.
I've fixed bugs in a memory allocator that's running in an app deployed on several hundred million PC's. It had a really fancy allocator that put a header with a magic number around malloc output, in addition to what you do, in an attempt to identify specific kinds of allocations. We'd see several tens of thousands of crashes a day due to magic number collision with real world data.
Your intuition is wrong. You can never assume that most local integer variables tend to have small values. Assign -3.0 to a float, and map that to an int, or read the current epoch time into an int, and see what happens.
A C garbage collector would certainly help write some code more easily, but it has to work, and it has to be "precise". An imprecise GC is worthless in production, but fun as an academic exercise.
- cygx 12y agoBoehm-Demers-Weiser does see 'real world' usage.
- im3w1l 12y agoTens of thousands of memory blocks that can't be freed daily, on an install base of several hundred million PC's sounds like an acceptable compromise, at least for non-critical applications.
- rayiner 12y agoThere are quite a few collectors in production that are conservative at least for the stack. D, Boehm, JSC, SBCL, etc. It can be a problem, but it often isn't, especially when you have precise knowledge of heap object layouts.
- deleted 12y ago[deleted]