Once I had fixed the typo in your program, I was able to run this loop without 
ado: 

> (for ((i (in-range 9))) (collect-garbage) (collect-garbage) (time (main i)))
cpu time: 1 real time: 1 gc time: 0
cpu time: 5 real time: 6 gc time: 0
cpu time: 9 real time: 9 gc time: 0
cpu time: 77 real time: 77 gc time: 0
cpu time: 736 real time: 741 gc time: 14
cpu time: 7666 real time: 7703 gc time: 393
... 

As far as I can tell time consumption grows by one order of magnitude as 
increase the size of the database entries by an order of magnitude. I don't 
have the time to it for 10, 11, and 12 but is it possible that something 
external/size-wise hits you here? 



#lang racket

(require db)

(define current-db (make-parameter (sqlite3-connect #:database 'memory)))

(query-exec (current-db) "CREATE TABLE sines(id INTEGER, x, sine_x)")

(define (x i) (+ (- pi) (/ i (* 1000 pi))))

(define (main n)
  (call-with-transaction 
   (current-db)
   (lambda ()
     (for ([i (expt 10 n)])
       (define x_i (x i))
       (query-exec 
        (current-db)
        (string-append 
         "INSERT INTO sines(id, x, sine_x) VALUES("
         (number->string i) ", "
         (number->string x_i) ", "
         (number->string (sin x_i)) ")"))))))

(provide main)



On Oct 29, 2013, at 4:32 PM, "Andrews, Kyle (KC)" <kcandr...@dow.com> wrote:

> I’ve been trying to upload data into an SQLite database using Racket from 
> Windows 7 64-bit and both Racket.exe and DrRacket.exe keep crashing before 
> the upload finishes.  I’ve had crashes on long-running programs in DrRacket 
> on Windows 7 before, so I don’t want to say for sure that it’s the fault of 
> the db library.  However, I do know is that the crashes have been happening 
> repeatedly with this project and given the amount of data I need to upload, 
> it is impractical to keep restarting Racket in the hopes that it will 
> eventually finish.  Racket is crashing with both 5.3.6 as well as the latest 
> nightly build you have installers for:   5.90.0.9.  I have attached a sample 
> script which creates an in-memory sqlite database and populates it with a 
> trillion sines which crashes on me after a while, just like my actual script. 
>  My Racket VM (at least in DrRacket) defaults to 2048 Mb.
>  
> Below is what error information Windows gives upon the crash:
>  
> Problem signature:
>   Problem Event Name: APPCRASH
>   Application Name:        Racket.exe
>   Application Version:    5.90.0.1
>   Application Timestamp:             525e4550
>   Fault Module Name:    libracket3m_9r9qx5.dll
>   Fault Module Version:                0.0.0.0
>   Fault Module Timestamp:         525e454e
>   Exception Code:             c0000005
>   Exception Offset:          00000000002b6081
>   OS Version:      6.1.7601.2.1.0.256.4
>   Locale ID:          1033
>   Additional Information 1:          9e37
>   Additional Information 2:          9e37a01f62fc211801609d8b20878795
>   Additional Information 3:          4bbb
>   Additional Information 4:          4bbb32ba4ab4514f5750e1fc710f6223
>  
> Let me know if there is any other information I can provide.
> Regards,
>  
> Kyle
>  
> <bug.rkt>____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users


____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to