taskGnash - The GNU Flash player - Tasks: task #7009, Implement garbage collector

 
 

You are not allowed to post comments on this tracker with your current authentication level.

task #7009: Implement garbage collector

Submitter:  Sandro Santilli <strk>
Submitted:  Fri 15 Jun 2007 10:51:32 AM UTC
   
 
Should Start On:  Thu 14 Jun 2007 10:00:00 PM UTC Should be Finished on:  Thu 14 Jun 2007 10:00:00 PM UTC
Category:  None Priority:  7 - High
Status:  Done Privacy:  Public
Assigned to:  strk Percent Complete:  100%
Open/Closed:  Closed Effort:  0.00

Jump to the original submission

Tue 03 Jul 2007 12:26:01 AM UTC, comment #6: 

A new commit reduced overhead of garbage collecting by not running the collector unless 10 newly registered collectible are found in the list since last run.

Sandro Santilli <strk>
Group Member
Sat 30 Jun 2007 06:27:38 PM UTC, comment #5: 

With latest patch we only collect as_object instances. This makes all my offline-tests pass (no segfaults or new errors).
More tests are welcome.

Next steps:

 - broader testing (should call on gnash-dev for it)
 - cleanup (remove unused methods/hacks to keep RC/GC a  
   compile-time option)
 - leaks analisys
 - gc interface design (gc_ptr? dumb_ptr?)

Sandro Santilli <strk>
Group Member
Mon 18 Jun 2007 09:06:15 AM UTC, comment #4: 

make check completes successfully now.

Sandro Santilli <strk>
Group Member
Sat 16 Jun 2007 08:39:15 AM UTC, comment #3: 

With current head, 'make check' doesn't trigger any memory fault
in misc-mtasc.all, samples, swfdec and movies.all.

Still, there are a couple of failures (which seems to be related to MOVIECLIP values) and a memory fault in misc-mtasc.all:

FAIL: place_and_remove_object_testrunner: _root.sh1 != undefined [/home/strk/src/gnash/gnash-head/testsuite/misc-ming.all/place_and_remove_object_test.c:76]
FAIL: place_and_remove_object_testrunner: expected: undefined obtained: _level0 [/home/strk/src/gnash/gnash-head/testsuite/misc-ming.all/place_and_remove_object_test.c:77]
FAIL: NetStream-SquareTestRunner died prematurely (SIGABRT)

Also, actinscript.all is of course still full of memory faults. I'm working on some of them now.


Sandro Santilli <strk>
Group Member
Fri 15 Jun 2007 09:00:49 PM UTC, comment #2: 

I committed the code, and with GC activated I already appreciated
some leaks fixes. In particular the simple movie:

frame1: function a() {}
frame2: <empty>

Does NOT leak anymore.

Also, a completely empty movie results in 8 resources collected
after first advance, so it seems we had an endemic 8 leaks at startup (over around 915 collectables in total)

Sandro Santilli <strk>
Group Member
Fri 15 Jun 2007 02:13:45 PM UTC, comment #1: 

I'm at a good point I think.

Basically we'll have a GNASH_USE_GC macro in smart_ptr.h
which would switch between ref-counting and garbage-collection
strategies.

Also, I needed to add a global gnashInit() function to properly
initialize the garbage collector, since it needs to be initialized
before any movie definition is created, being movie definitions gnash::resource derivates (thus ref-counted or GcResource).

When GNASH_USE_GC is defined, intrusive_ptr has NO effect on construction and destruction (no add-ref,drop-ref calls) and the ref_counted class itself does not provide those functions, nor the get_ref_count() one. Basically, ref_counted would just be an empty
definition used to easily provide GcResource interface (will derive from it).

Now, GcResource, in turn, will register any created GcResource instance (thus ref_counted instance) to the GC singleton (initialized in gnashInit()). Then, movie_root, at end of it's ::advance call, will call the GC collector, for mark&sweep.

The mark phase relies on GcResource::setReachable methods being
implemented in all derivates. I implemented it for as_object, as_function, swf_function, sprite_instance, movie_def_impl, sprite_definition, BitmapMovieDef classes and provided related methods in as_environment, MovieLibrary and some others I lost track of :)

If GNASH_USE_GC is NOT defined, we'll have the previous behaviour.

To help with development, you should define GNASH_USE_GC
and run from simple to complex movies until a memory corruption
happens. Memory corruptions are surely due to missing or not properly implemented GcResource::markReachableResources() methods.
These methods are the ones responsibhle to mark all reachable
resources, which are resources which should NOT be deleted
by the collector at the end of the mark scan.

Will commit ASAP, with GNASH_USE_GC defaulting to undefined.

Sandro Santilli <strk>
Group Member
Fri 15 Jun 2007 10:51:32 AM UTC, original submission:  

Garbage collection should replace reference counting for all ActionScript-referenciable objects.

Sandro Santilli <strk>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by strk (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-07-22 strk StatusIn Progress Done
        Percent Complete80% 100%
        Open/ClosedOpen Closed
    2007-06-30 strk Percent Complete70% 80%
    2007-06-18 strk Percent Complete60% 70%
    2007-06-16 strk Percent Complete50% 60%
    2007-06-15 strk Percent Complete30% 50%
    2007-06-15 strk Percent Complete20% 30%

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code