#Lists don't seem to clear from memory when parent Object is Destroy()ed

1 messages · Page 1 of 1 (latest)

boreal wedge
#

if anyone has any suggestions for how to deal with this pls lemme know

median meadow
#

is the list creating new tiles or just referencing ones that already exist

#

because when you destroy a list, the elements only get destroyed if nothing else is referencing them

boreal wedge
#

it's creating a brand new list and tile items every time.

#

nothing else should be referencing them, only the individual enemy objects that have them.

median meadow
#

if the tiles derive from UnityEngine.Object (like a monobehaviour, gameobject, asset, etc) then they get handled slightly differently and you need to destroy them by hand

#

because they never get garbage collected

boreal wedge
#

hm. well a Tile is a custom class object

median meadow
#

plain c# class?

boreal wedge
#

yes

#
public class Block
{
//stuff
}
#

so to create one it's new Block() or whatever

median meadow
#

hm yeah

#

if youre certain there are no more references to the tile objects after the list is gone, then the memory has got to be from something else

boreal wedge
#

is there some way I could determine what's clogging up the memory, directly?
I just assumed it was that cus it's a relatively large list of information every time an enemy respawns

median meadow
#

unity has a memory profiler

#

Window>analysis>profiler

boreal wedge
#

ah. didn't realize it had something for memory, directly.

median meadow
#

probably a bunch of videos for learning how to read it

boreal wedge
#

is it able to be included in a build?

median meadow
#

hmm im not sure about in a build

#

i know theres like debug build options might wanna check those out

boreal wedge
#

it's just much harder to figure out from the editor cus the editor has a lot of overhead.

#

alright well thx for the help, hopefully I'll get 'er figured