chromatic writes:
On Thursday 19 July 2007 01:56:21 Leopold Toetsch wrote:
Am Donnerstag, 19. Juli 2007 02:48 schrieb Will Coleda:

>      void init() {
>          PMC* counter;
>
>          PMC_str_val(SELF) =
>              string_make_empty(INTERP, enum_stringrep_one, 0);
>          PObj_custom_mark_SET(SELF);
>
> /* initialized our counter that keeps track of register > numbers */
>          counter = pmc_new(INTERP, enum_class_Integer);
>          VTABLE_set_integer_native(INTERP, counter, 10);
>          PMC_data(SELF) = counter;
> } The problem is as follows:
1) PObj_custom_mark_SET(SELF);
2) counter = pmc_new(INTERP, enum_class_Integer);
3) PMC_data(SELF) = counter;
In 1) you enable marking. 2) might cause a garbage collection, while the
integer PMC isn't yet anchored. This is only done at step 3).

The Integer PMC or the String? Perhaps I'm naive to expect that the system scanner will find counter, as it's on the stack. Is that not the case?
-- c

This code is now checked into the 'codestring-pmc' branch for your perusal.

Reply via email to