Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Because memory safety and because garbage collectors are faster than ref counting. That's why you can't delete it
-
@12bitfloat
yeah, memory safety, sure but if handled properly you wont have problems with it anyway.
And language itself has excception that can handle it regardless (object reference is not set to instance of object) if I understand it correctly? -
b3b340655yI read a few months ago that microsoft wanted to somehow garbage collect objects in vc++. Not sure if its true but rip if it is.
-
b3b340655y@DubbaThony can't find the article anymore so I guess it was pure trashtalk from my side.
-
@DubbaThony https://docs.microsoft.com/en-us/...
using blocks are basically deletes with curly braces. -
@bkwilliams but it requires creating instance next to it, i have array of references and want to purge some of objects I no longer need. Oh, did I mention its unity?
So im unsure if it's revelant, anyway maybe Im nitpicking some of this doc and its not working for me.
Anyway, thanks, that may come in handy. -
@bkwilliams Using (or as Java calls it "try-with-resources") only helps with closing the resource by literally calling the close() method. It doesn't delete the object
-
The cries of those who despise manual memory management drown out the cries of those who desire it
-
@AlgoRythm ;(
I found Destroy() in unity docs...
I don't know how it works internally but at least **seems** to work maybe? No idea. Seems to work. -
@DubbaThony It "deletes" the GameObjects but doesn't delete the actual allocated objects. There's no way around waiting for the next GC.
You should really worry less about objects. Garbage collectors are specifically designed to deal with this sorta stuff. Even heap allocating temp objects like Vectors isn't fatal because all modern GC's are tiered -
@DubbaThony If you're really that concerned with getting every last ounce of performance you really shouldn't be using Unity and instead roll your own engine. That's an immense amount of work though
-
Why WOULD you want to do it manually ?
You have using/dispose if you relly really want it.
You can force GC to collect (Bad practice) -
kurast3305yIf you are so inclined to do it, just close them and call GC.
If you wanted memory management so bad you should use a language that allows it. -
Hazarth95195yIm with you on this one, GC is an extra layer of unecessary processing when you know what you're doing. I don't want anything more than for GC to be there, but still give me control over the memory efficiently. But alas, get used to GC's... Its not going away no matter how it hurts
-
@kurast
Can you do so in unity?
Only engine I know that allows so is unreal aaaand kindda nah for me. Dont get me wrong, i like c++ but i am aware c++ is slower to write in for me even if I really really enjoy it (yeah and I enjoy debugging, dont question it, okay?) -
@12bitfloat
Templates?
Less "standard high level" operations and more Wacky::<Syntax>("that I hate so much")
Managing memory is actually one of things I dont find bottlenecking me
Related Rants
mini rant
So I finally started toying around C#.
As much as I tried to avoid it, as much as I wanted, well, sometimes there is need. I was laying it off and laying it off...
There are some things that well.. aren't my taste but whatever.
But come on why the fuck I cannot delete explicitly?
What do you mean "just assign it to null and GC will eventually kill off that instance"
No, I want that fucker to die here and right now. Like in good ol' C++.
rant
c#