------------------------------------------------------------------------------------------------------------- [BUG/PRB.] VFP 9.0 FIX - PURGE CACHED MEMORY AND TRY AGAIN AFTER ALLOCATE USER OBJECT MEMORY FAILED January 2024 ------------------------------------------------------------------------------------------------------------- CCB 1. BUG: If we disable purging cached memory and try again after allocate user object memory failed in Visual FoxPro Advanced, sometimes it causes the error "There is not enough memory to complete this operation (Error 43)". 2. CAUSE: There are some BUGs in the following code. 3. RESOLUTION: We can write some code to fix the BUG. Fun420d46 :: ; proc near cmp eax , 0800h ;0x00420d46 : 3d00080000 push ebx ;0x00420d4b : 53 mov ebx , 01h ;0x00420d4c : bb01000000 ja Label506b0c ;0x00420d51 : 0f87b55d0e00 Label420d57 :: mov edx , dword ptr [ esi + 32 ] ;0x00420d57 : 8b5620 test edx , edx ;0x00420d5a : 85d2 je Label42372c ;0x00420d5c : 0f84ca290000 mov ecx , dword ptr [edx] ;0x00420d62 : 8b0a mov ecx , dword ptr [ ecx - 4 ] ;0x00420d64 : 8b49fc sub ecx , 08h ;0x00420d67 : 83e908 cmp ecx , eax ;0x00420d6a : 3bc8 jb Label423743 ;0x00420d6c : 0f82d1290000 Label420d72 :: mov eax , ebx ;0x00420d72 : 8bc3 pop ebx ;0x00420d74 : 5b ret ;0x00420d75 : c3 Label506b0c :: mov byte ptr [ Data936f18 ] , bl ;0x00506b0c : 881d186f9300 jmp Label420d57 ;0x00506b12 : e940a2f1ff Label42372c :: ; ; -------------------------------------------------------------------------------------------------- ; VFP 9.0 FIX - PURGE CACHED MEMORY AND TRY AGAIN AFTER ALLOCATE USER OBJECT MEMORY FAILED ; April 2021 ; -------------------------------------------------------------------------------------------------- ; CCB ; ; Purge cached memory and try again after allocate user object memory failed. ; ; 2021/4/15, by ccb ; mov ecx , eax push ecx pushd 08h ;0x0042372c : 6a08 call Fun42bf2a ;0x0042372e : e8f7870000 mov dword ptr [ esi + 32 ] , eax ;0x00423733 : 894620 ; ; -------------------------------------------------------------------------------------------------- ; VFP 9.0 FIX - PURGE CACHED MEMORY AND TRY AGAIN AFTER ALLOCATE USER OBJECT MEMORY FAILED ; April 2021 ; -------------------------------------------------------------------------------------------------- ; CCB ; ; Purge cached memory and try again after allocate user object memory failed. ; ; 2021/4/15, by ccb ; pop ecx test eax , eax jne Label423736 cmp dword ptr vfpa_sys9058_data,00h je Label423736 push ecx ;; Purge Cached File Data Buffer mov eax , 07FFFFFFFh call Fun68507b ;; Purge Cached Virtual Memory push esi push ecx lea esi , dword ptr [ esp ] mov dword ptr [ esp ] , 07FFFFFFFh call Fun7e0c91 pop ecx pop esi ; IF VFPA_VERSION GE 102 ; ;; Purge Cached Large Memory ; call vfpa_lmm_purgecachedmemory ; ENDIF ; IF VFPA_VERSION GE 102 ; ;; Set Process Working Set Size for Large Memory ; call vfpa_lmm_setprocessworkingsetsize ; ENDIF pop ecx mov eax , ecx pushd 08h call Fun42bf2a mov dword ptr [ esi + 32 ] , eax jmp Label423736 Label423736 :: test eax , eax ;0x00423736 : 85c0 je Label58dab7 ;0x00423738 : 0f8479a31600 jmp Label420d72 ;0x0042373e : e92fd6ffff Label423743 :: ; ; -------------------------------------------------------------------------------------------------- ; VFP 9.0 FIX - PURGE CACHED MEMORY AND TRY AGAIN AFTER ALLOCATE USER OBJECT MEMORY FAILED ; April 2021 ; -------------------------------------------------------------------------------------------------- ; CCB ; ; Purge cached memory and try again after allocate user object memory failed. ; ; 2021/4/15, by ccb ; mov ecx , eax push ecx push edx pushd 00h ;0x00423743 : 6a00 push edx ;0x00423745 : 52 mov ecx , eax ;0x00423746 : 8bc8 call Fun42c2c4 ;0x00423748 : e8778b0000 ; ; -------------------------------------------------------------------------------------------------- ; VFP 9.0 FIX - PURGE CACHED MEMORY AND TRY AGAIN AFTER ALLOCATE USER OBJECT MEMORY FAILED ; April 2021 ; -------------------------------------------------------------------------------------------------- ; CCB ; ; Purge cached memory and try again after allocate user object memory failed. ; ; 2021/4/15, by ccb ; pop edx pop ecx test eax , eax jne Label42374d cmp dword ptr vfpa_sys9058_data,00h je Label42374d push ecx push edx ;; Purge Cached File Data Buffer mov eax , 07FFFFFFFh call Fun68507b ;; Purge Cached Virtual Memory push esi push ecx lea esi , dword ptr [ esp ] mov dword ptr [ esp ] , 07FFFFFFFh call Fun7e0c91 pop ecx pop esi ; IF VFPA_VERSION GE 102 ; ;; Purge Cached Large Memory ; call vfpa_lmm_purgecachedmemory ; ENDIF ; IF VFPA_VERSION GE 102 ; ;; Set Process Working Set Size for Large Memory ; call vfpa_lmm_setprocessworkingsetsize ; ENDIF pop edx pop ecx pushd 00h push edx mov ecx , ecx call Fun42c2c4 jmp Label42374d Label42374d :: jmp Label423736 ;0x0042374d : ebe7 Label58dab7 :: test byte ptr [ Data936f10 ] , bl ;0x0058dab7 : 841d106f9300 je Label58dae3 ;0x0058dabd : 7424 mov eax , dword ptr [ Data936f14 ] ;0x0058dabf : a1146f9300 test eax , eax ;0x0058dac4 : 85c0 jne Label58daed ;0x0058dac6 : 7525 mov dword ptr [ esi + 4 ] , ebx ;0x0058dac8 : 895e04 mov dword ptr [ Data936f14 ] , 0B6h ;0x0058dacb : c705146f9300b6000000 mov byte ptr [esi] , 049h ;0x0058dad5 : c60649 mov dword ptr [ esi + 12 ] , 00h ;0x0058dad8 : c7460c00000000 xor eax , eax ;0x0058dadf : 33c0 pop ebx ;0x0058dae1 : 5b ret ;0x0058dae2 : c3 Label58dae3 :: mov ecx , 0B6h ;0x0058dae3 : b9b6000000 call Fun544742 ;0x0058dae8 : e8556cfbff Label58daed :: mov dword ptr [ esi + 4 ] , ebx ;0x0058daed : 895e04 mov byte ptr [esi] , 049h ;0x0058daf0 : c60649 mov dword ptr [ esi + 12 ] , 00h ;0x0058daf3 : c7460c00000000 xor eax , eax ;0x0058dafa : 33c0 pop ebx ;0x0058dafc : 5b ret ;0x0058dafd : c3 4. APPLIES TO: VFP 6.0.8167.0 VFP 6.0.8961.0 (SP5) VFP 7.0.0.9262 VFP 7.0.0.9465 (SP1) VFP 8.0.0.2521 VFP 8.0.0.3117 (SP1) VFP 9.0.0.2412 VFP 9.0.0.3504 (SP1) VFP 9.0.0.4611 (SP2) VFP 9.0.0.5015 (SP2) VFP 9.0.0.5411 (SP2) VFP 9.0.0.5721 (SP2) VFP 9.0.0.5815 (SP2) VFP 9.0.0.6303 (SP2) VFP 9.0.0.6602 (SP2) VFP 9.0.0.7423 (SP2) The bug has been fixed in VFP Advanced. 5. REFERENCE WEBSITES: 1, baiyujia.com: http://www.baiyujia.com http://www.baiyujia.com/vfpdocuments/f_vfp9fix168.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix166.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix167.asp 6. OTHER: For reference only, there is no guarantees. Any questions or suggestions, please send me an email at ccb2000@163.com. |