sprhawk / python-on-a-chip

Automatically exported from code.google.com/p/python-on-a-chip
Other
0 stars 0 forks source link

Fix GC so base classes are not collected #91

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In heap.c(heap_gcMarkObj) the cl_bases tuple of class objects is not 
marked. This leads to a memory error or an assertion.

Solution:
Insert the Lines marked with -->>

   case OBJ_TYPE_CLO:
      /* Mark the obj head */
       OBJ_SET_GCVAL(pobj, pmHeap.gcval);

       /* Mark the attrs dict */
       retval = heap_gcMarkObj((pPmObj_t)((pPmClass_t)pobj)->cl_attrs);
-->>   PM_RETURN_IF_ERROR(retval);

-->>   /* Mark the base tuple */
-->>   retval = heap_gcMarkObj((pPmObj_t)((pPmClass_t)pobj)->cl_bases);

   break;

Original issue reported on code.google.com by i...@moticon.de on 29 May 2010 at 1:25

GoogleCodeExporter commented 9 years ago
Thank you, Michael, for this great find and fix!  The fix looks spot on.  I'm 
trying to 
make a regression test for this defect and will mainline this issue in a few 
days.

Original comment by dwhall...@gmail.com on 3 Jun 2010 at 4:15

GoogleCodeExporter commented 9 years ago
Made a regression test that exposes this issue, but then the test fails due to 
Issue 
#39.

Original comment by dwhall...@gmail.com on 5 Jun 2010 at 5:51

GoogleCodeExporter commented 9 years ago
r493
- Fine-tuned system test t291 and got it to work without needing to fix Issue 
#39.
- Added system test t291
- Edited src/vm/heap.c per Michael's fixes shown above.
- Minor update to src/tools/pmHeapDump.py (PM_TYPES were out-of-date).
- Minor update to docs/src/DevelopmentProcess.txt (remnant from Issue #75)

Original comment by dwhall...@gmail.com on 6 Jun 2010 at 4:24