From: David M. <ig...@us...> - 2006-01-19 09:05:41
|
Update of /cvsroot/myoledb/myoledb3 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22546 Modified Files: hashtbl.cpp rowset.cpp Log Message: Calculate the extra page of memory in the correct place, so we don't run out of memory for small rows Index: hashtbl.cpp =================================================================== RCS file: /cvsroot/myoledb/myoledb3/hashtbl.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- hashtbl.cpp 17 Jan 2006 13:25:10 -0000 1.2 +++ hashtbl.cpp 19 Jan 2006 09:05:30 -0000 1.3 @@ -270,7 +270,8 @@ cbPage = sysinfo.dwPageSize; } - cbReserve = ((cslotMax *cbSlot + sizeof( LSTSLOT )) / cbPage + 1) *cbPage; + // We have to reserve enough for our cbCommitFirst (a page) plus the total we will commit + cbReserve = ((cslotMax *cbSlot + sizeof( LSTSLOT )) / cbPage + 2) *cbPage; pbAlloc = (BYTE *) VirtualAlloc( NULL, cbReserve, MEM_RESERVE, PAGE_READWRITE ); if (pbAlloc == NULL) Index: rowset.cpp =================================================================== RCS file: /cvsroot/myoledb/myoledb3/rowset.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- rowset.cpp 18 Jan 2006 10:18:49 -0000 1.3 +++ rowset.cpp 19 Jan 2006 09:05:31 -0000 1.4 @@ -425,8 +425,7 @@ // List of free slots. // This manages the allocation of sets of contiguous rows. - // We only need a maximum of TotalRows+1 (which is what we allocate) +1 for the extra page allocated - if (FAILED( InitializeSlotList( m_pData->m_dwTotalRows+2, + if (FAILED( InitializeSlotList( m_pData->m_dwTotalRows+1, m_cbRowSize, g_dwPageSize, m_prowbitsIBuffer, &m_pIBuffer, &m_rgbRowData ))) return E_FAIL; |