[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

No Subject


I'm currently developing an interface between mzscheme - which i like
a lot, thank you for this fantastic program and rich documentation! -
and matlab, which is great for number-crunching.
It's already working but still bare-bones and i want to improve on it.
Sorry for the many questions, but as you will see i have no clue about
the behaviour of the garbage-collector of mzscheme ... as well as any
other garbage-collector or garbage-collection in general to be honest.

I have defined a new Scheme_Type like this:

typedef struct {
  Scheme_Type type;
  void *data_ptr;
  Scheme_Manager_Reference *manager_ptr;
} Scheme_Matlab_type;

data_ptr points to the matlab-data which can not be scheme_malloced
and must be explicitly freed.

My questions concerning this szenario:
- Do i need the MZ_HASH_KEY_EX?
- Do i need the reference to the custodian?
  It's only part of the structure because in case the object gets
  garbage-collected - and its finalizer has been evoked - the
  finalizer might call 'scheme_remove_managed'. Is this necessary?
- Do i need to use custodians at all? Maybe registering a finalizer is
- Should i malloc instances of this new type with
  'scheme_malloc' or rather use 'scheme_malloc_atomic' ? 
- Will all allocated memory be freed after killing the scheme-process?
- Should i use 'scheme_register_finalizer' or 'scheme_add_finalizer'?

Every hint would help me a lot.