On 06-Nov-00 at 16:17, Alexander Mai ([EMAIL PROTECTED]) wrote:
> On Mon, Nov 06, 2000 at 11:57:58AM -0500, Rick Scott wrote:
> > At least 1 thing that you are missing is the granularity of the memory
> > allocation scheme. From the OS perspective, if you ask for 80 bytes, this
> > may come from memory allready allocated to you. However your app may not
> > have any free memory, so the OS will allocate you a page of memory. A page
> > may be, say 4K. So for the next ~50 allocations of 80 bytes you will not
> > be getting anymore memory from the OS, simply using what you have already
> > been given. This probably explains why you don't see a leak for n <= 17.
> > This is why the leak tests typically loop through 10,000 iterations, to
> > try to average out some of the granularity.
> >
> [...]
>
> Good point.
>
> It also makes clear that the tests are not too precise,
Correct. But as n->infinity a fairly accurate number should emerge.
> in fact if really a leak exists independent of the widget
> creation number, you can not get it this way. And the other way
> round the claimed value is only an estimate result.
The leak _has_ to be associated to the creation process, since this is the only
thing the loop does. The first cycle, or so, may end up creating hash tables,
caches, and such, so for small numbers of iterations all the memory allocated
during the create is not returned by the destroy, but this may be by design.
Hash tables and caches are there to re-use the "stuff" in them, so for large
numbers of iterations the result should be a good estimate.
>
> Somehow the return value being an int suggests we get an exact value here
> ... ;-)
The ones that I have tracked down have been very close, if we were leaking a
struct foo, then the number was sizeof(struct foo).
>
>
> OTOH while trying to make a nice plot of the "leak-function" I again ran
> into a famous crash on alpha and guess I better don't search for
> a few bytes memory per widget but for something more important ...
Could this be from the cast of a void * to an int for the comparison???
>
> --
> Alexander Mai
> [EMAIL PROTECTED]
>
>