Prev: FabToys et al
Next: Register problem Report Pro
From: Peter Gargos on 10 Oct 2007 05:20 Hi all, I have my own quick sort routine with recursive calls. Sorting 1000 or higher items cause "Kid stack size limit exceeded". Routine crash afther 665 self calls, MEMORY_STACKKID show 675. SetKidStackSize has no any effect. I you set StackSize to 16MB ( default is 8kB ), before crash KidStackFree func report 16769116 bytes free !!. Where is problem ? ( VO28+SP1 ) Thanks, Peter Gargos Softcomp Technology
From: Geoff Schaller on 10 Oct 2007 05:39 Show us the code! Do you want us to guess? "Peter Gargos" <pgargos(a)hotmail.com> wrote in message news:1192008035.766055.117120(a)k79g2000hse.googlegroups.com: > Hi all, > I have my own quick sort routine with recursive calls. > Sorting 1000 or higher items cause "Kid stack size limit exceeded". > Routine crash afther 665 self calls, MEMORY_STACKKID show 675. > SetKidStackSize has no any effect. I you set StackSize to 16MB > ( default is 8kB ), > before crash KidStackFree func report 16769116 bytes free !!. > Where is problem ? ( VO28+SP1 ) > > Thanks, > > Peter Gargos > Softcomp Technology
From: Marc Verkade [Marti IT] on 10 Oct 2007 09:50 When I have this, it is cause by code like this... Method Stop() Class WinStop Return Self:Stop() -- Grtz, Marc "Peter Gargos" <pgargos(a)hotmail.com> schreef in bericht news:1192008035.766055.117120(a)k79g2000hse.googlegroups.com... > Hi all, > I have my own quick sort routine with recursive calls. > Sorting 1000 or higher items cause "Kid stack size limit exceeded". > Routine crash afther 665 self calls, MEMORY_STACKKID show 675. > SetKidStackSize has no any effect. I you set StackSize to 16MB > ( default is 8kB ), > before crash KidStackFree func report 16769116 bytes free !!. > Where is problem ? ( VO28+SP1 ) > > Thanks, > > Peter Gargos > Softcomp Technology >
From: Werner Perplies on 10 Oct 2007 09:53 Marc, Am Wed, 10 Oct 2007 15:50:57 +0200 schrieb Marc Verkade [Marti IT]: > When I have this, it is cause by code like this... > > Method Stop() Class WinStop > Return Self:Stop() You call stop() recursive an so you put with every call another return address to the stack! Werner -- German phpBB-Board for Visual Objects user: http://www.weepee.eu/forum/vo/ divUtilies: new version 14th June, 2006 http://www.weepee.eu/vo/DivUtilities/DivUtilities.zip
From: Peter Gargos on 10 Oct 2007 10:44
Hi Geoff, this code is QuickSort routine implemented to Anthony RAMDBF. Work perfectly on small number on items and very fast. METHOD QuickSortDword( nCol AS DWORD, nStart AS DWORD, nStop AS DWORD ) AS VOID PASCAL CLASS RamDbf LOCAL pTemp1 AS PTR LOCAL pTemp2 AS PTR LOCAL pivot AS DWORD LOCAL i AS DWORD LOCAL pivotValue AS DWORD // urcujici typ !! pTemp1 := MemAlloc( _dwRecordSize ) pTemp2 := MemAlloc( _dwRecordSize ) IF nStart = 0 nStart := 1 ENDIF IF nStop = 0 nStop := SELF:LastRec ENDIF pivot := nStart SELF:Goto( pivot ) pivotValue := SELF:FieldgetDword( nCol ) MemCopy( pTemp2, _ptrRecordStartAt, _dwRecordSize ) FOR i := nStart + 1 UPTO nStop SELF:Goto( i ) IF SELF:FieldgetDword( nCol ) < pivotValue MemCopy( pTemp1, _ptrRecordStartAt, _dwRecordSize ) SELF:Goto( pivot ) MemCopy( _ptrRecordStartAt, pTemp1, _dwRecordSize ) SELF:Goto( pivot + 1 ) MemCopy( pTemp1, _ptrRecordStartAt, _dwRecordSize ) SELF:Goto( i ) MemCopy( _ptrRecordStartAt, pTemp1, _dwRecordSize ) SELF:Goto( pivot + 1 ) MemCopy( _ptrRecordStartAt, pTemp2, _dwRecordSize ) pivot += 1 ENDIF NEXT IF pivot - nStart >= 2 SELF:QuickSortDword( nCol, nStart, pivot-1 ) ENDIF IF nStop - pivot >= 2 SELF:QuickSortDword( nCol, pivot+1, nStop ) ENDIF MemFree( pTemp1 ) MemFree( pTemp2 ) RETURN I still don't understand why SetKidStackSize have no effect on this. Peter Gargos Softcomp Technology |