/ Check-in [74fff692]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add the "-heap" option to the command-line shell - to allocate a fixed heap for use with SQLITE_ENABLE_MEMSYS5.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 74fff692345fed4b247e2b34c1e63b4d50cddfd4
User & Date: drh 2010-12-17 14:03:02
Context
2010-12-20
17:00
Clarify the documentation of the SQLITE_STATUS_MALLOC_COUNT parameter to sqlite3_status(). check-in: 3b41bcc3 user: drh tags: trunk
15:51
Add additional DBSTATUS options for measuring the hit and miss rates against the lookaside memory pool - information useful in tuning the lookaside size. Currently experimental pending analysis of performance impact. Closed-Leaf check-in: 34613f1d user: drh tags: experimental
2010-12-17
14:03
Add the "-heap" option to the command-line shell - to allocate a fixed heap for use with SQLITE_ENABLE_MEMSYS5. check-in: 74fff692 user: drh tags: trunk
01:00
Fix minor typos in the sqlite3_backup documentation. check-in: df430be5 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/shell.c.

  2538   2538     */
  2539   2539   #ifdef SIGINT
  2540   2540     signal(SIGINT, interrupt_handler);
  2541   2541   #endif
  2542   2542   
  2543   2543     /* Do an initial pass through the command-line argument to locate
  2544   2544     ** the name of the database file, the name of the initialization file,
         2545  +  ** the size of the alternative malloc heap,
  2545   2546     ** and the first command to execute.
  2546   2547     */
  2547   2548     for(i=1; i<argc-1; i++){
  2548   2549       char *z;
  2549   2550       if( argv[i][0]!='-' ) break;
  2550   2551       z = argv[i];
  2551   2552       if( z[0]=='-' && z[1]=='-' ) z++;
................................................................................
  2556   2557         zInitFile = argv[i];
  2557   2558       /* Need to check for batch mode here to so we can avoid printing
  2558   2559       ** informational messages (like from process_sqliterc) before 
  2559   2560       ** we do the actual processing of arguments later in a second pass.
  2560   2561       */
  2561   2562       }else if( strcmp(argv[i],"-batch")==0 ){
  2562   2563         stdin_is_interactive = 0;
         2564  +    }else if( strcmp(argv[i],"-heap")==0 ){
         2565  +      int j, c;
         2566  +      const char *zSize;
         2567  +      sqlite3_int64 szHeap;
         2568  +
         2569  +      zSize = argv[++i];
         2570  +      szHeap = atoi(zSize);
         2571  +      for(j=0; (c = zSize[j])!=0; j++){
         2572  +        if( c=='M' ){ szHeap *= 1000000; break; }
         2573  +        if( c=='K' ){ szHeap *= 1000; break; }
         2574  +        if( c=='G' ){ szHeap *= 1000000000; break; }
         2575  +      }
         2576  +      if( szHeap>0x7fff0000 ) szHeap = 0x7fff0000;
         2577  +#if defined(SQLITE_ENABLE_MEMSYS3) || defined(SQLITE_ENABLE_MEMSYS5)
         2578  +      sqlite3_config(SQLITE_CONFIG_HEAP, malloc((int)szHeap), (int)szHeap, 64);
         2579  +#endif
  2563   2580       }
  2564   2581     }
  2565   2582     if( i<argc ){
  2566   2583   #if defined(SQLITE_OS_OS2) && SQLITE_OS_OS2
  2567   2584       data.zDbFilename = (const char *)convertCpPathToUtf8( argv[i++] );
  2568   2585   #else
  2569   2586       data.zDbFilename = argv[i++];
................................................................................
  2662   2679       }else if( strcmp(z,"-version")==0 ){
  2663   2680         printf("%s\n", sqlite3_libversion());
  2664   2681         return 0;
  2665   2682       }else if( strcmp(z,"-interactive")==0 ){
  2666   2683         stdin_is_interactive = 1;
  2667   2684       }else if( strcmp(z,"-batch")==0 ){
  2668   2685         stdin_is_interactive = 0;
         2686  +    }else if( strcmp(z,"-heap")==0 ){
         2687  +      i++;
  2669   2688       }else if( strcmp(z,"-help")==0 || strcmp(z, "--help")==0 ){
  2670   2689         usage(1);
  2671   2690       }else{
  2672   2691         fprintf(stderr,"%s: Error: unknown option: %s\n", Argv0, z);
  2673   2692         fprintf(stderr,"Use -help for a list of options.\n");
  2674   2693         return 1;
  2675   2694       }