あまりにも長い間、私はガベージ コレクターにその魔法を任せ、自分自身からすべての責任を取り除きました。
悲しいことに、それが問題になることはありませんでした.
今考えてみると、「破棄」機能が実際に何をするのか、いつどのように実装する必要があるのか よくわかりません。
ファイナライズの同じ質問...
そして最後の質問...私はクラスpictureManipulationを持っています:保存/サイズ変更/フォーマットの変更が必要なとき...私はそのクラスの新しいインスタンスを開始し、そのオブジェクトを使用します...まあ、ガベージコレクションにインスタンスを強制終了させます
class student
{
public void displayStudentPic()
{
PictureManipulation pm = new PictureManipulation();
this.studentPic = pm.loadStudentImage(id);
}
}
Class Test
{
student a = new Student();
a.displayStudentPic();
// Now the function execution is ended... does the pm object is dead? Will the GC will kill it?
}