Foros del Web » Programación para mayores de 30 ;) » Programación General » Visual Basic clásico »

VB6 Liberar memoria

Estas en el tema de VB6 Liberar memoria en el foro de Visual Basic clásico en Foros del Web. Como puedo liberar memoria de mi aplicación, ya que juega con gran cantidad de volumenes de datos y esto la relentiza, e incluso la cuelga ...
  #1 (permalink)  
Antiguo 06/12/2005, 05:41
Avatar de MeXiCaN  
Fecha de Ingreso: mayo-2004
Ubicación: Barcelona - España , Morelia - México
Mensajes: 162
Antigüedad: 20 años
Puntos: 0
VB6 Liberar memoria

Como puedo liberar memoria de mi aplicación, ya que juega con gran cantidad de volumenes de datos y esto la relentiza, e incluso la cuelga alguna vez.
__________________
Un saludo, MeXiCaN :golpeado: :adios:

Poco es tanto, cuando poco necesitas. E.Bunbury

Siempre que haya una causa noble por la que luchar, siempre habrá ladrones que la apoyarán.
  #2 (permalink)  
Antiguo 06/12/2005, 08:20
Avatar de jc_moty  
Fecha de Ingreso: septiembre-2005
Ubicación: Usulután, El Salvador
Mensajes: 477
Antigüedad: 18 años, 7 meses
Puntos: 1
Lo que podes hacer es establecer cada objeto a Nothing, cuando ya no lo vas a utilizar en el mismo procedimiento, funcion o evento...
Código:
Set objeto = Nothing
Saludos
  #3 (permalink)  
Antiguo 06/12/2005, 09:08
Avatar de aldo1982  
Fecha de Ingreso: noviembre-2004
Ubicación: Santa Fe (Argentina) Colon F.C
Mensajes: 1.362
Antigüedad: 19 años, 5 meses
Puntos: 6
Código:
Dim Arch As String
Arch = "C:\Memoria.vbs"
Close #1
Open Arch For Output As #1
Print #1, "FreeMem = Space(" & Slider1.Value * 10000 & ")"
Close #1
Shell ("rundll32.exe url.dll,FileProtocolHandler " & "C:\Memoria.vbs")
salu2
__________________
LA MUERTE ESTÁ TAN SEGURA DE VENCER QUE NOS DA TODA UNA VIDA DE VENTAJA
  #4 (permalink)  
Antiguo 10/12/2005, 05:36
Avatar de MeXiCaN  
Fecha de Ingreso: mayo-2004
Ubicación: Barcelona - España , Morelia - México
Mensajes: 162
Antigüedad: 20 años
Puntos: 0
¿Y como puedo detectar la memoria del pc, porque claro, yo se la que tengo yo, pero por ejemplo no se la que tienes tu?
__________________
Un saludo, MeXiCaN :golpeado: :adios:

Poco es tanto, cuando poco necesitas. E.Bunbury

Siempre que haya una causa noble por la que luchar, siempre habrá ladrones que la apoyarán.
  #5 (permalink)  
Antiguo 11/12/2005, 15:03
 
Fecha de Ingreso: abril-2005
Mensajes: 351
Antigüedad: 19 años
Puntos: 3
hola te paso dos ejemplos del api guide:

Private Type LARGE_INTEGER
LowPart As Long
HighPart As Long
End Type
Private Type MEMORYSTATUSEX
dwLength As Long
dwMemoryLoad As Long
ullTotalPhys As LARGE_INTEGER
ullAvailPhys As LARGE_INTEGER
ullTotalPageFile As LARGE_INTEGER
ullAvailPageFile As LARGE_INTEGER
ullTotalVirtual As LARGE_INTEGER
ullAvailVirtual As LARGE_INTEGER
ullAvailExtendedVirtual As LARGE_INTEGER
End Type
Private Declare Function GlobalMemoryStatusEx Lib "kernel32.dll" (ByRef lpBuffer As MEMORYSTATUSEX) As Long
Private Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Private Sub Form_Load()
'KPD-Team 2001
'URL: http://www.allapi.net/
'E-Mail: [email protected]
Dim MemStat As MEMORYSTATUSEX
Dim TotalPhys As Currency
'initialize structure
MemStat.dwLength = Len(MemStat)
'retireve memory information
GlobalMemoryStatusEx MemStat
'convert large integer to currency
TotalPhys = LargeIntToCurrency(MemStat.ullTotalPhys)
'show result
MsgBox "Current memory load: " + CStr(MemStat.dwMemoryLoad) + vbCrLf + _
"Total RAM: " + CStr(Int(TotalPhys / 1024 ^ 2)) + " Mb.", vbInformation
End Sub
Private Function LargeIntToCurrency(liInput As LARGE_INTEGER) As Currency
'copy 8 bytes from the large integer to an empty currency
CopyMemory LargeIntToCurrency, liInput, LenB(liInput)
'adjust it
LargeIntToCurrency = LargeIntToCurrency * 10000
End Function


y el otro

Private Type MEMORYSTATUS
dwLength As Long
dwMemoryLoad As Long
dwTotalPhys As Long
dwAvailPhys As Long
dwTotalPageFile As Long
dwAvailPageFile As Long
dwTotalVirtual As Long
dwAvailVirtual As Long
End Type
Private Declare Sub GlobalMemoryStatus Lib "kernel32" (lpBuffer As MEMORYSTATUS)
Private Sub Form_Load()
'KPD-Team 1998
'URL: http://www.allapi.net/
'E-Mail: [email protected]
Dim MemStat As MEMORYSTATUS
'retrieve the memory status
GlobalMemoryStatus MemStat
MsgBox "You have" + Str$(MemStat.dwTotalPhys / 1024) + " Kb total memory and" + Str$(MemStat.dwAvailPageFile / 1024) + " Kb available PageFile memory."
End Sub
  #6 (permalink)  
Antiguo 11/12/2005, 16:16
Avatar de MeXiCaN  
Fecha de Ingreso: mayo-2004
Ubicación: Barcelona - España , Morelia - México
Mensajes: 162
Antigüedad: 20 años
Puntos: 0
De acuerdo

Gracias!! Los probaré a ver que tal!!
__________________
Un saludo, MeXiCaN :golpeado: :adios:

Poco es tanto, cuando poco necesitas. E.Bunbury

Siempre que haya una causa noble por la que luchar, siempre habrá ladrones que la apoyarán.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 18:08.