Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: callbacks

From: lmecir:mbox:vol:cz at: 1-Nov-2007 6:49

Maxim Olivier-Adlhoch napsal(a):
> hi Lad, > > although its fixing the crashing, safe structs now act as a huge memory > leak. its about half the amount of doing recycl/off... in my tests so far. > > -MAx >
Certainly. You should protect the memory "using other means". The ADDRESS-AS-STRUCT function as written by me does not protect the memory against GC intentionally. It should not be necessary to protect the memory against GC, if the memory is already protected "by other means". Example: a: head insert/dup copy "" "1234567890" 4 b: head insert/dup copy "" "abcdefghij" 4 ma: memory? string-address? a 40 mb: memory? string-address? b 40 ; no problem occurs, since ; MA is protected by 'a ; MB is protected by 'b recycle probe as-string ma ; unprotecting MA a: none ; now this is a problem, since MA isn't protected recycle probe as-string ma As you can see, the problem was caused by the fact, that I "unprotected" the memory, not in the ADDRESS-AS-STRUCT function. Warning! Another way how to unprotect MA might have been just to do e.g.: insert tail a "1234567890" , since it causes memory reallocation. Does this make sense to you? -L