|
Then that would be an actual garbage collector, which I'm trying to avoid.
Actually what I'm doing is kind of clever.
I allow you to allocate a "MemoryPool" on the heap or the stack, and then allocate memory from that pool. It does not allow you to delete. However, all allocated segments are always contiguous and sequential, leading to a number of performance advantages. Instead of deleting single allocations you can freeAll() to reset/recycle the entire pool and invalidate the memory therein. It's actually quite nice for a lot of basic processing scenarios. it's just inefficient for mutable data where sizes can change - which it's not designed for.
Real programmers use butterflies
|
|
|
|
|
That's what AAA games use (and maybe non-AAA too, I only know what DICE did, as I worked there) - arena allocators.
When a level starts, it allocates from its own "arena", and when the level is done, the arena is wiped.
Lessens the risk of memory leaks and gives full control and trackability of all allocations.
Time you enjoy wasting is not wasted time - Bertrand Russel
|
|
|
|
|
Blasphemy! Quick, fall on your knees and repent, or you will see hordes with torches and pitchforks gathering. While the .Net guys are not as fanatically religious as Holy Order of the Javaites, they could still burn you like their steaks at a stake (*).
(*) FTMS - fixed that myself.
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
Sounds like you're in regression.
Next year you'll be hot for C and after that you'll start a club with Codewraith doing 1802 assembler for your own Zwölf.
Wrong is evil and must be defeated. - Jeff Ello
Never stop dreaming - Freddie Kruger
|
|
|
|
|
Or you could run in circles, like poor Sander. He hasn't noticed yet because he's still on his first lap.
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
That would make 3 people in the club - though I usually prefer C to assembler, I like a good delve into the madness from time to time.
GCS d--(d+) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
|
|
|
|
|
Ok, now give it a name that references literature, something like "Quixote Garbage Collector".
Then make a slogan that's inspired by LOTR, maybe "I am Gandalf the White and I've come to collect your garbage" or "There is no curse in Elvish, Entish, or the tongues of Men for this garbage collector."
Now live out your life as Facebook, Google, Microsoft or Apple buys you out for quintagazillions$$$ and share some with me
(For those who miss the joke, read post below)
|
|
|
|
|
It doesn't really do garbage collection as such.
As an analogy imagine the garbage man came once a week and burned your house down. It's much more time and space efficient than taking out the trash.
You can't actually delete objects in my scheme, only allocate to pools. You can recycle entire pools though, manually, freeing (invalidating) all pointers (or objects) therein.
Doing it that way makes it fast fast fast and it works on constrained memory environments. Also it was easy to code.
Real programmers use butterflies
|
|
|
|
|
honey the codewitch wrote: burned your house down. It's much more time and space efficient than taking out the trash. How the heck is burning down a house every week efficient?
|
|
|
|
|
It saves you from having to take the garbage out.
Real programmers use butterflies
|
|
|
|
|
That's more like deleting your entire application to solve a single bug...
Maybe you just don't know how analogies work?
|
|
|
|
|
No, that's basically how my code works.
Real programmers use butterflies
|
|
|
|
|
|
Article methinks - I think you should write a book - Random thoughts of a clever mad Witch
"I didn't mention the bats - he'd see them soon enough" - Hunter S Thompson - RIP
|
|
|
|
|
You don't simply collect Garbage in Mordor!
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
Garbage shall not pass.
Wrong is evil and must be defeated. - Jeff Ello
Never stop dreaming - Freddie Kruger
|
|
|
|
|
I reserve that one for some unit test. "YOU ! Shall! Not! Pass!"
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
Sure, C++ is love, but at what price does this "love" cost? your soul, I am sure. We are talking about C++ here.
|
|
|
|
|
My soul? Oh that old thing? I think I traded it for some concert tickets back in the day.
Real programmers use butterflies
|
|
|
|
|
|
magic!
Real programmers use butterflies
|
|
|
|
|
Also confusing language and libraries. e.g. C++ managed and unmanaged.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Some of us find the light again. Some of us never lose it.
"They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"
|
|
|
|
|
When I saw your post, I wondered how badly you were going to get flamed, given the popularity of C# on this site. I never thought this thread would stay so civilized, let alone be fairly positive.
|
|
|
|
|
I share your surprise.
Real programmers use butterflies
|
|
|
|