Re: Linked List issue / debugging
I see what you mean now. You're right.. that is much smaller.
Basically getting rid of specific lists for each byte size.
Poor planning from the begining (ie: all those lists) kind of made my code what it is now.
Ill try and flesh it out a bit more....
(I kind of whish I had started with that from the begining)
Thanks for helping me out.. ill post back with what I came up with.
Re: Linked List issue / debugging
Sorry it took a minute to get back to you.
I got a chance to sit down and mess around with your approach, and it would work if there was only 1 size of chunk.
In my approach, I had one object that contained all of my lists - memoryPoolManager.
In your approach - unless im mistaken - I would need several objects that all had one list to handle the various sizes (8,32,64,256,512,1024,4000,16000) - so 8byteManager, etc..
So the initialization/allocation/deallocation etc, would all need switches or if's or somekind of loop to handle the objects. Aditionally, all those objects would need to be stored inside the memory pool so they can be accessed in other areas.
This would take up more space than having the one object in the memory pool.
So I was trying to minimize that amount of space taken up in the memory pool which led to more code.... I can appreciate the elegance of yours though.
Re: Linked List issue / debugging
Quote:
Originally Posted by
ghostfacelz
Sorry it took a minute to get back to you.
I got a chance to sit down and mess around with your approach, and it would work if there was only 1 size of chunk.
In my approach, I had one object that contained all of my lists - memoryPoolManager.
In your approach - unless im mistaken - I would need several objects that all had one list to handle the various sizes (8,32,64,256,512,1024,4000,16000) - so 8byteManager, etc..
Then create a class that has all of these instances and manage them. Instead of stuffing 8, 9, 10, different pointers, duplicating code, etc. just create a class that has the instances that you need.
Regards,
Paul McKenzie