Opened on 04/04/2014 at 10:01:42 AM

Closed on 05/12/2014 at 09:57:22 AM

Last modified on 04/01/2019 at 08:42:48 PM

#258 closed change (fixed)

[Typed objects] Implement a garbage collection mechanism

Reported by: trev Assignee: trev
Priority: P2 Milestone:
Module: Core Keywords:
Cc: Blocked By:
Blocking: #145, #393 Platform:
Ready: yes Confidential: no
Tester: Verified working: no
Review URL(s):

http://codereview.adblockplus.org/6213754488356864/

Description (last modified by trev)

Background

Typed objects proposal doesn't specify any special garbage collection behavior, typed objects apparently get garbage collected just like any other JavaScript object. This isn't something we can implement, for us it is impossible to tell which typed objects are still in use. Reference counting should be the easiest solution, it will also allow us to run destructors when an object is freed.

What to change

Add ObjectBase.retain() and ObjectBase.release() methods that will be common to all typed objects. An object is created with reference count 1, the code creating it should always call ObjectBase.release() at some point (we'll eventually need static analysis to verify that it does). Any other code that want to hold on to the object should call ObjectBase.retain() and then ObjectBase.release() when the object is no longer needed. Typed references should do this automatically when their value is set, for regular JavaScript code we'll have to do it manually (hopefully a rare occasion).

Attachments (0)

Change History (5)

comment:1 Changed on 04/22/2014 at 03:36:41 PM by trev

  • Owner set to trev
  • Status changed from new to assigned

comment:2 Changed on 04/28/2014 at 05:37:25 AM by trev

  • Description modified (diff)

comment:3 Changed on 04/28/2014 at 07:10:19 AM by trev

  • Review URL(s) modified (diff)
  • Status changed from assigned to reviewing

comment:4 Changed on 04/28/2014 at 07:12:52 AM by trev

  • Blocking 393 added

comment:5 Changed on 05/12/2014 at 09:57:22 AM by trev

  • Resolution set to fixed
  • Status changed from reviewing to closed

Add Comment

Modify Ticket

Change Properties
Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from trev.
 
Note: See TracTickets for help on using tickets.