while on the subject of linked lists, why is it that all of the tutorials
(and my C++ book) never delete any of the memory they have created?!

Is it just bad programming or can you leave it for windows to clean up?

----- Original Message -----
From: "Persuter" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 28, 2002 5:20 AM
Subject: RE: [hlcoders] Particle System


> Jim: yeah, that's what I said earlier. The benefit of using arrays lies
> in the fact that they're sequential and initialized early, so no memory
> allocation time. But as you so correctly pointed out, the problem of
> figuring out the most efficient use of space within the array is not
> simple.
>
> Anyway, I think we're all forgetting the 80-20 rule here. 80% of
> processing time is taken up by 20% of the program. I seriously doubt,
> based on my observations, that at reasonable amounts of particles, a
> carefully-programmed particle system using linked lists is in that 20%.
>
> Also, consider this. If you initialize a long linked list at the
> beginning of the program and create all the individual rendering lists
> from that, you get most of the advantages of sequentiality without the
> staticness of arrays, since malloc or new will allocate sequential
> memory. You can grow the list at any time, and you can shrink it within
> the program if memory limits start to be reached.
>
> Persuter
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:hlcoders-
> > [EMAIL PROTECTED]] On Behalf Of Jim Hunter
> > Sent: Thursday, June 27, 2002 11:28 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [hlcoders] Particle System
> >
> > > Sure, having the ability to create a *variable* number of particles
> is a
> > > plus by using a linked list over an array. Why have 20,000 dormant
> > > classes/structures taking up memory when you don't have to? How
> about
> > > allocating new particles? Are you supposed to scan through the
> entire
> > array
> > > each time you wish to create a new particle to find that indexes 919
> and
> > > 9294-12300 are free? By using a linked list, you can simply store a
> > pointer
> > > to the last particle and then add on to it as necessary.
> >
> > Forgive my ignorance, but aren't you just shifting that burden (of
> finding
> > empty space to store a new particle) from your own code to the heap
> > manager?
> > I have no idea which would be more efficient, but either way,
> *something*
> > has got to look for storage space and determine that it's unused, and
> > reclaim space that is no longer used.  I would bet the performance
> would
> > be
> > close to equal; anyone know if a formal analysis of such a problem has
> > been
> > done?  Just curious.
> >
> > Jim
> >
> > _______________________________________________
> > To unsubscribe, edit your list preferences, or view the list archives,
> > please visit:
> > http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives,
please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
>

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to