Copy code and build a web app and run it,you refresh explorer,you will find memory will be up, up, up…
Any idea?
using System;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
using System.Collections;
public class Class1 : MonoBehaviour
{
void Awake()
{
#region this block memory leak
ff[] list = new ff[100000];
for (int i = 0; i < list.Length; i++)
{
list[i] = new ff();
}
#endregion
//GameObject g = GameObject.Find("Cube");
//GameObject[] list1 = new GameObject[100];
//for (int i = 0; i < list1.Length; i++)
//{
// list1[i] = GameObject.Instantiate(g) as GameObject;
//}
}
void OnDisable()
{
//Resources.UnloadUnusedAssets();
Application.ExternalEval("alert(0)");
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
}
}
public class ff
{
public int count1;
public int count2;
public int count3;
public int count4;
public int count5;
public int count6;
public int count7;
public int count8;
public int count9;
public int count10;
public int count11;
public int count12;
public int count13;
public int count14;
public int count15;
public int count16;
public int count17;
public int count18;
public int count19;
public int count20;
public int count21;
public int count22;
public int count24;
public int count25;
public int count26;
public int count27;
public int count28;
public int count29;
public int count30;
public int count31;
}