(import scheme (chicken base) (chicken blob) (chicken foreign) (chicken file posix) srfi-4) (foreign-declare "#include ") (define lowrite (foreign-lambda ssize_t "write" int c-pointer size_t)) (define (test x n) (let ((s (lowrite fileno/stdout x n))) (print "\n" s))) (let* ((s "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq") (b (string->blob s)) (v (blob->u8vector b))) (test (location s) (string-length s)) (test (location b) (u8vector-length v)) (test (location v) (u8vector-length v))) ;; OUTPUT ;; abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq ;; 56 ;; abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq ;; 56 ;; abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq ;; 56 ;; VALGRIND ;; ==1841369== ;; ==1841369== HEAP SUMMARY: ;; ==1841369== in use at exit: 1,224,072 bytes in 3,620 blocks ;; ==1841369== total heap usage: 3,631 allocs, 11 frees, 1,231,446 bytes allocated ;; ==1841369== ;; ==1841369== LEAK SUMMARY: ;; ==1841369== definitely lost: 0 bytes in 0 blocks ;; ==1841369== indirectly lost: 0 bytes in 0 blocks ;; ==1841369== possibly lost: 0 bytes in 0 blocks ;; ==1841369== still reachable: 1,224,072 bytes in 3,620 blocks ;; ==1841369== suppressed: 0 bytes in 0 blocks ;; ==1841369== Rerun with --leak-check=full to see details of leaked memory ;; ==1841369== ;; ==1841369== For lists of detected and suppressed errors, rerun with: -s ;; ==1841369== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)