Re: free seems not work
- Posted by mattlewis (admin) Feb 22, 2011
- 1735 views
PtitChaud said...
Hello,
i run the Euphoria 4 code below on vista and the result, noticed into the ex.err file, is
D:\Programme\euphoria\euphoria\include\std\machine.e:81 in function allocate()
Your program has run out of memory.
One moment please...
n = 10000
cleanup = 0
iaddr = <no value>
eaddr = <no value>
the 2 Giga memory line is reached, after the 3rd call to the UnCycleComplet procedure. Where is my mystake ? or the free statement doesn't release back the memory to the system ? or any idea ?
The problem is that ptr_liste in UnCycleComplet() is not updated by the call to allocate_bcl(). You could change your code to (only showing the parts that changed):
function allocate_bcl(sequence ptr_liste) for j=1 to BOUCLE do ptr_liste[j]=allocate(10000) end for return ptr_liste end function procedure UnCycleComplet() sequence ptr_liste ptr_liste = repeat(0,BOUCLE) for i=1 to NOMBRE_CYCLE do ptr_liste = allocate_bcl(ptr_liste) free_bcl(ptr_liste) end for end procedure
Matt