SQLite

Check-in [30f014d3d0]
Login

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

Overview
Comment:Fix a mutex leak in the new malloc-free memory allocator. (CVS 4494)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 30f014d3d0231a668c40508ff4a6b90ce622c857
User & Date: drh 2007-10-20 12:34:01.000
Context
2007-10-20
13:17
Go back to allocating each page and its header with a single memory allocation. This undoes the change of (4409). (CVS 4495) (check-in: f56c9884be user: drh tags: trunk)
12:34
Fix a mutex leak in the new malloc-free memory allocator. (CVS 4494) (check-in: 30f014d3d0 user: drh tags: trunk)
2007-10-19
17:47
Added an experimental malloc-free memory allocation subsystem, intended for use on embedded systems. Runs 7% faster than when using system malloc() on Linux. (CVS 4493) (check-in: 8487ca82fa user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/mem3.c.
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
** use of malloc().  All dynamically allocatable memory is
** contained in a static array, mem.aPool[].  The size of this
** fixed memory pool is SQLITE_MEMORY_SIZE bytes.
**
** This version of the memory allocation subsystem is used if
** and only if SQLITE_MEMORY_SIZE is defined.
**
** $Id: mem3.c,v 1.1 2007/10/19 17:47:25 drh Exp $
*/

/*
** This version of the memory allocator is used only when 
** SQLITE_MEMORY_SIZE is defined.
*/
#if defined(SQLITE_MEMORY_SIZE)







|







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
** use of malloc().  All dynamically allocatable memory is
** contained in a static array, mem.aPool[].  The size of this
** fixed memory pool is SQLITE_MEMORY_SIZE bytes.
**
** This version of the memory allocation subsystem is used if
** and only if SQLITE_MEMORY_SIZE is defined.
**
** $Id: mem3.c,v 1.2 2007/10/20 12:34:01 drh Exp $
*/

/*
** This version of the memory allocator is used only when 
** SQLITE_MEMORY_SIZE is defined.
*/
#if defined(SQLITE_MEMORY_SIZE)
543
544
545
546
547
548
549

550
551
552
553
554
555
556
    sqlite3MemsysAlarm(nBytes-nOld);
  }
  p = internal_malloc(nBytes);
  if( p==0 ){
    sqlite3MemsysAlarm(nBytes);
    p = internal_malloc(nBytes);
    if( p==0 ){

      return 0;
    }
  }
  if( nOld<nBytes ){
    memcpy(p, pPrior, nOld);
  }else{
    memcpy(p, pPrior, nBytes);







>







543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
    sqlite3MemsysAlarm(nBytes-nOld);
  }
  p = internal_malloc(nBytes);
  if( p==0 ){
    sqlite3MemsysAlarm(nBytes);
    p = internal_malloc(nBytes);
    if( p==0 ){
      sqlite3_mutex_leave(mem.mutex);
      return 0;
    }
  }
  if( nOld<nBytes ){
    memcpy(p, pPrior, nOld);
  }else{
    memcpy(p, pPrior, nBytes);