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

[REBOL] Dumping memory

From: logan::steeve::gmail::com at: 29-Sep-2008 8:32

You want to see how R2 deals with memory ? With this few lines you can make some discoveries. REBOL [] ;*** create a string a get his address in memory s: make struct! [str [string!]] ["start"] from: to integer! reverse copy third s int-bin: func [int][debase/base to-hex int 16] get-value: func [from][ hex: clear #{00000000000000000000000000000000} len: 16 until [ change third s reverse debase/base to-hex from 16 str: copy/part either empty? s/str [#{00}][head insert tail copy s/str #{00}] len insert tail hex str from: from + length? str 0 = len: len - length? str ] hex ] ;**** Dump 30 values added after the initial value ;**** Each value in Rebol sizes a multiple of 16 bytes loop 30 [ found: get-value from print [int-bin from found as-string found] from: from + 16 ] halt