Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SERIOUS BUG: Memory lack with property array strings
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Titre:
SERIOUS BUG: Memory lack with property array strings
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01031030
Message ID:
01031030
Vues:
68
On VFP, a variable/property asks additional heap's memory
only if the length overcomes the 7 bytes.

This is visible from the speed of the second cycle, with length of 8 characters,
which, also, requires the double one of memory.

The BUG:
In the case in which the array has at least 2^16 elements,
the data heap doesn't come released
CLEAR

ADDPROPERTY(_screen,"memorystart",VAL(SYS(1016)))

? "string elements with len=7 don't alloc heap memory, and array size is under 2^16"
Test (2^14-1,7)
? "string elements with len=8 alloc heap memory, and array size is under 2^16"
? "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
? "LOOK SPEED AND SIZE WHEN HEAP ALLOC/DEALLOC IS DONE"
? "
? "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
Test (2^14-1,8)	&& string alloc heap memory
? "string elements with len=7 don't alloc heap memory, and array size is 2^16"
Test (2^14,7)	&& string don't alloc heap memory
? "string elements with len=8 alloc heap memory, and array size is 2^16"
? "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
? "LOOK HEAP IT IS NOT DEALLOCATED SPEED IS SLOWER THE FIRT STEP ONLY"
? "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
Test (2^14,8)	&& string alloc heap memory

REMOVEPROPERTY(_screen,"memorystart")

PROCEDURE Test (numero,stringSize)
ADDPROPERTY(_screen,"memorystart",VAL(SYS(1016)))
? "memory start VALUE ",_screen.memorystart
FOR K=1 TO 8
	PRIVATE z1
	Z1=CREATEOBJECT("empty")
	=ADDPROPERTY(m.z1,[Members(1,4)],.null.)
	DIMENSION z1.Members[numero,4]
	FOR j=1 TO ALEN(m.z1.Members,1)
		 z1.Members[m.j,1]=SPACE(stringSize)
		 z1.Members[m.j,2]=SPACE(stringSize)
		 z1.Members[m.j,3]=SPACE(stringSize)
		 z1.Members[m.j,4]=SPACE(stringSize)
	NEXT

	? "memory allocate  INCREMENT",VAL(SYS(1016)) - _screen.memorystart
* WORKAROUND
*	 z1.Members=''
* SPEEDUP HEAP RELEASE
*       z1 = NULL
	RELEASE z1
	?? "   deallocate INCREMENT",VAL(SYS(1016)) - _screen.memorystart
NEXT
CLEAR ALL
? "memory end VALUE ",SYS(1016), "INCREMENT",VAL(SYS(1016)) - _screen.memorystart
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform