Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Help: How To Free Up Memory In Vb 6 0!


I'm new in vb programming and i would like to know how to free up memory in vb 6.0 because my project using a lot memory so i need to free up the allocated memory each process finish so it won't crash.

Thank




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Free Memory
Hi guys, anyone knows how to get the Free Memory Space value ?

'cause I'm making a program and it'll be very very very slow if the user has got too low memory, so I wanted to detect, and then, run the prog, or say him/her to restart windows...

thanx

Getting Free Memory?
is there any api call (or anything else for that matter) to get free memory and total memory? thanks...

Free Memory
Q-1 I am herer again......thank you for your patience, but you realy helping us a lot. I have a problem when i want to make a code for the file menue "New". When i click on new i want to remove all the information that was stored during the program run time in the memory and when i click on open i want to start from the begining . is ther any code to do it

Q-2 How can i check whether the file is already open or not ?

thanks again

How To Free Memory From My App?
Hello Everybody,
I want to know How To Free Memory from my app.

Thank you all in advance,
ERAN

CPU Memory Free
I have a question and hopefully someone will know the answer. I need to be able to show how much CPU memory is free on the C drive and how much is being used. My friend said that he thinks that he was able to do it in about 5 lines of code and it wasn't shelling it but he doesn't remember. Does anyone know how I can obtain this from the system simply?

Free Memory.
Hi,

i have seen programs which can "free memory" for you. Thats they I guess free RAM for you.
Can someone give me an idea how do I go about it.

many Thanks

Memory Used & Free
Does anyone know how to get this information ?

Free Up Memory
Hello All Members
I have make a code which have alot of variables which take a big space from the computer memory.
How can i free up the memory after using my code?.
Thanks alot for help and advice

Egyptian Man

Free Up Memory
my system also face a problem, that is program not respond after run some time.

anyone know to free up the memory ? beside close connection.

Free Memory With A Vb App
Does anybody know how to free memory in a vb app.
I found a vbs file wich contained:
FreeMem = Space(24000000)

I would like to do about the same in vb

thnx

How To Free The OS Unwanted Memory
Hi2All,

I saw an application called "Speed It Up" that releases the unwanted memory from the os and increased the memory availability for the os. How this application is freeing up the memory? Is there any API function to free the unwanted memory in the OS? I am keen in knowing that process? If anyone knows about this drop the lines here....

Nazim.

Free Up Your Program's Memory
Lemme explain what I mean. I have a simple PRELOADER program that sits in my systray. This PRELOADER only sits there to monitor hotkeys and launch an external application. Problem is, it uses about 4 mb of memory. It uses about 2mb to start out, and then after an application has been launched and it's menu and msgbox items have been invoked, it goes up to about 4 to 4.5 mb. The only and only form is hidden from view and it does not contain a border style and does not show itself ever. I noticed that if i have a regular form and I minimize it, the memory is freed and usage goes down to about 462kb and then once I used the program again it'll go back up to about 2.5-3mb usage and if i minimize again, it'll go back to about 462kb of memory usage.

My question to you all, is there a call to the API that windows uses to free up memory when you minimize. Can I replicate this call ? If so how ? I can't simply have the form go from normal state to minimize because the form is hidden and u can't perform these operations on a hidden form.

- AAG

Redim (does It Free Memory) ??
here's my question :

I have an array containing object. This array contains about 11000 - 12000 objects... so when I don't need these objects anymore, I want to free them form memory.
my question is : if I use the redim myArray(0), do all my objects will be cleared from memory???

thanks!

Free All Memory From Program?
I am working on a program that is memory-intensive, and although I will be going through trying to make it as effecient as possible, I believe it will still use a lot. It will need the ability to restart, and therefore *basically* perform the same thing with different data again.

Is there anyway I can "clear" all data from the memory currently associated with the program, or ANYTHING that would help me out... thanks!

Avaliable Free Memory
how can i find how many Mb of memory are not used in my system by code?

Vb Program Does Not Free Up Memory
Hi All

My application loads controls (command buttons) at runtime, with the top, left, caption, etc. properties. I do this with for/next statements, which I close afterwards.

After I have run the program a few times, my pc becomes very sluggish, and vb has alreay reported that it is out of memory.

How can I get my app to free all 'memory it is using after it has
ended?

Any help would be great.

Thanx
Reinhardt

How To Monitore Free Memory
I programm with vb6 and need to knwo wthe amount of free memory available at any time during run.
Is there any code or commands for this?
Thanks

Amon.

Free Memory From An Adodc
hi gurus.
help me please....:
in my form i have an adodc object, thats connected to an access
database.......
this database is quite big and i want to release the memory it
cought, when i close the form!
i have been told to right: adodc.recordset=nothing
but it dosn't work nor dose: adodc.recordset.close ...
so please sombody help me......

Resolve Free Memory
How to resolve the amount of free memory in bytes?
I want to use my own swap-file, since it is faster than
Windows uses its swap file, and it has no limit in space.

Thanks! EatMe - HowLongDoesThisTake@hotmail.com

Creating Free Memory
Does anyone have any code or know anything about creating a VB app, which can free up windows memory. I know thins can be done, because I have seen some code somewhere before.

Ian

Free Memory From Adodc Object
hi gurus....
i have an adodc object that is connected to a access database,
when i unload my form i want to free the memory the adodc used.
is it posible?

thanks.

Free Some System Memory When Our Porogram Is Running
Hi.
I made a program that uses a timer to go every 1 second to a mysql database check possible changed and if changes appears it changes the program. well I could identify that this operation passed 8 hours blocks my computer. It eats about 1mb per minute. The question is how can I free some system memory to avoid it crashes.
By the way do you know a possible better way ro access a database in a short interval time with put the computer so slow?
Thanks

Teixeira

Free DLL For Reading Real Low Memory Contents?
Hi, I am actually using some free DLLs to operate Ins and Outs at the Parallel port.

Right now I want to implement the software to identify all the installed parallel ports, so I need to read memory address $408...$40F to identify the LPT1...3 physical port addresses.

I found a particular nice DLL that does that. The MEMACC.DLL, but it is not free, and the demo version shows a nag screen, so...

This MEMACC gives me exactly what I want from the low real memory addresses, exactly as if you are reading using DOS assembly;

mov ax,0000
mov es,ax
mov al,es:[408h]

Any good soul to point me to some free DLL that gives me direct access to low memory?

Of course, it needs to be able to deal with Win98/ME/XP/2000/NT...

Thanks a bunch,
Wagner.

Get Total And Free Video Memory (without Using DirectX)
Hi as the title says, I need obtain the Total and Free video memory but I don't want to use DirectX.

Thanks !!!

How To Free Allocated Memory For Adodc.recordset
i use dbcombo and adodc (microsoft ado data control 6.0) in one of my application. during form_unload i want to free the memory residence of adodc.recordset

i try
adodc.recordset.close
but adodc.recordset.close method doesn't free the allocated memory for adodc.recordset, it only close the recordset. but there is still allocated memory for adodc.recordset.

in adodb i may use
adodbrecordset.close 'close the recordset
set adodbrecordset= nothing 'it makes the memory free

but i can't find such a code like set adodb.recordset=nothing for adodc.recordset.

anyone can help on how to free allocated memory for adodc.recordset

Free Memory Allocation In Other App! Api Bugged? On Vista?
Hi!
I get a dll error by VirtualFreeEx!
It says wrong parameters :S
I started using this api 3 monthes ago, and my code works without freeing up memory but I'm bored of that "bug"!
Could somebody help whats wrong?
I read msdn2, the parameters are good!

http://msdn2.microsoft.com/en-us/library/aa366894.aspx

Declaration and call:

Code:
Private Declare Function VirtualFreeEx Lib "kernel32.dll" (ByVal hProcess As Long, ByVal lpAddress As Long, ByVal dwSize As Long, ByVal dwFreeType As Long) As Long

result = VirtualFreeEx(pHandle, pItemRectMemory, rectsize, MEM_RELEASE)
If result = 0 Then Debug.Print "Error releasing memory: " & getAPIErrorText(err.LastDllError)

Are There Are Free Tools To Test For Memory Leaks In VB 6
I am testing a program that appears to have some type of memory leak. Have not been able to track it down. Is there a way to do this without buying a suite of test software?

Outlook VB Memory Doesn't Free... And Clocks While Running
In the past year I've written various VB routines to perform maintenance tasks in Outlook 2000.

In most of them, I'm looping through messages and either extracting or updating. I have two problems.
[list=1][*]Clocking - while running, nothing else can be done in Outlook. Is there any way around this?[*]Memory isn't freeing up. Even though I believe I'm freeing objects as it runs, I can see that the memory is getting more and more booked -- I need to periodically increase my swap file as the amount of data grows.[/list=1]

The 2nd item is the biggest problem. I've attached a bit of code which I use to "export" data from a "HelpTicket" public folder into a SQL table. I do this because it makes reporting run much quicker and easier.

Any help would be much appreciated ....

Quote:




Dim curItem As Outlook.TaskItem
Public myDB


Sub Do_HelpTicketExport()
Const DATA_SOURCE = "ODBC;DSN=HELPTICKET;"
Dim strSQL
Dim i As Integer
Dim wrkDefault As Workspace

'Dim dbe As DAO.Database
Err.Clear 'Clear errors and Connect to the Database

Set wrkDefault = DBEngine.Workspaces(0)

'Set dbe = Item.Application.CreateObject("DAO.DBEngine.35")
Set myDB = OpenDatabase("", False, False, DATA_SOURCE)
If Err.Number <> 0 Then
MsgBox Err.Description & Chr(13) & "OpenDatabase failed"
Exit Sub
End If

strSQL = "truncate table HELPTICKET"
myDB.Execute strSQL, dbSQLPassThrough

' Set up Outlook Objects.
Dim ol As New Outlook.Application
Dim olns As Outlook.NameSpace
Dim cf As Outlook.MAPIFolder
Dim c As Outlook.ContactItem
Dim Prop As Outlook.UserProperty
Dim colItems As Items

Set olns = ol.GetNamespace("MAPI")
Set cf = olns.Application.ActiveExplorer.CurrentFolder 'Should be a HelpTicket folder
Set colItems = cf.Items

'Debug.Print "In Folder: " + cf.Name

NumItems = cf.Items.Count

' Loop through all of the items in the folder
For i = 1 To NumItems
Set curItem = cf.Items.item(i)

'Debug.Print i & curItem.MessageClass
' Insert it into the HelpTicket folder

If Left(curItem.MessageClass, 20) = "IPM.Task.Help Ticket" Then

wrkDefault.BeginTrans ' added to try to help with memory problem -- it didn't help

strSQL = "INSERT INTO HELPTICKET " & _
"( AssignedBy,AssignedOn,AssignedTo,CloseDate,CompletePercent,...morehere ...Subject,TotalWork) " & _
" " & _
"VALUES " & _
"( " & _
CustomItemVal("AssignedBy") & CustomItemVal("AssignedOn") & CustomItemVal("AssignedTo") & CustomItemVal("Close Date") & CustomItemVal("Complete Percent", 1) & ...morehere... (curItem.DateCompleted) & "," & Quotify(curItem.Subject) & "," & curItem.TotalWork & _
")"

'Debug.Print strSQL
'Debug.Print "Ticket ID: " & CustomItemVal("Ticket ID")

myDB.Execute strSQL, dbFailOnError

wrkDefault.CommitTrans

Set curItem = Nothing 'try to free up memory

End If
Next


End Sub

Does Deletedc Free Up Memory Immediately Or Once Exit Procedure?
I am using some code I found (think it might have been this site even) for blitting a transparent bitmap. I think it is causing a memory leak though. One thing I noticed was that after it calls the deletedc (maskdc), the maskdc still seems to exist. At least, when I call ?maskdc in the immediate window, it still gives out a Long instead of just zero. Does that mean the memory wasn't freed up? If so, any suggestions?  Ah, as I now see once I posted the code, some dude named Vegard Fiksdal wrote it a while back. Heh.




'Written by Vegard Fiksdal, 2003

Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Declare Function SetBkColor Lib "gdi32" (ByVal hdc As Long, ByVal crColor As Long) As Long
Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function CreateBitmap Lib "gdi32" (ByVal nWidth As Long, ByVal nHeight As Long, ByVal nPlanes As Long, ByVal nBitCount As Long, lpBits As Any) As Long
Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Declare Function GetObject Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) As Long
Public Sub TransparentBlt(dsthDC As Long, srchDC As Long, x As Integer, y As Integer, Width As Integer, Height As Integer, TransColor As Long)
    Dim maskDC As Long      'DC for the mask
    Dim tempDC As Long      'DC for temporary data
    Dim hMaskBmp As Long    'Bitmap for mask
    Dim hTempBmp As Long    'Bitmap for temporary data
    'First create some DC's. These are our gateways to assosiated bitmaps in RAM
    maskDC = CreateCompatibleDC(dsthDC)
    tempDC = CreateCompatibleDC(dsthDC)
    'Then we need the bitmaps. Note that we create a monochrome bitmap here!
    'this is a trick we use for creating a mask fast enough.
    hMaskBmp = CreateBitmap(Width, Height, 1, 1, ByVal 0&)
    hTempBmp = CreateCompatibleBitmap(dsthDC, Width, Height)
    '..then we can assign the bitmaps to the DCs
    hMaskBmp = SelectObject(maskDC, hMaskBmp)
    hTempBmp = SelectObject(tempDC, hTempBmp)
    'Now we can create a mask..First we set the background color to the
    'transparent color then we copy the image into the monochrome bitmap.
    'When we are done, we reset the background color of the original source.
    TransColor = SetBkColor(srchDC, TransColor)
    BitBlt maskDC, 0, 0, Width, Height, srchDC, 0, 0, vbSrcCopy
    TransColor = SetBkColor(srchDC, TransColor)
    'The first we do with the mask is to MergePaint it into the destination.
    'this will punch a WHITE hole in the background exactly were we want the
    'graphics to be painted in.
    BitBlt tempDC, 0, 0, Width, Height, maskDC, 0, 0, vbSrcCopy
    BitBlt dsthDC, x, y, Width, Height, tempDC, 0, 0, vbMergePaint
    'Now we delete the transparent part of our source image. To do this
    'we must invert the mask and MergePaint it into the source image. the
    'transparent area will now appear as WHITE.
    BitBlt maskDC, 0, 0, Width, Height, maskDC, 0, 0, vbNotSrcCopy
    BitBlt tempDC, 0, 0, Width, Height, srchDC, 0, 0, vbSrcCopy
    BitBlt tempDC, 0, 0, Width, Height, maskDC, 0, 0, vbMergePaint
    'Both target and source are clean, all we have to do is to AND them together!
    BitBlt dsthDC, x, y, Width, Height, tempDC, 0, 0, vbSrcAnd
    'Now all we have to do is to clean up after us and free system resources..
    DeleteObject (hMaskBmp)
    DeleteObject (hTempBmp)
    DeleteDC (maskDC)
    DeleteDC (tempDC)
End Sub




RAPI - Find Available Free Memory Space On The PocketPC
I need to find the amount of available free space
on the pockePC memory.
I need to do this progarammatically thru an
application that runs on the desktop system(VBApp)

Purushothama R Naidu
pespurshi@usa.net

How To Free Memory Occupied By &"LONG Or INT TYPE&" Variables In VB?
Hii all,

How to free memory when you have too many "LONG or INTEGER" type variables?

I know you can use "ERASE" command to free memory occupied by arrays. But it does not work for "LONG or INTEGER" type variables.

HDave

A Good Free Datagrid Control.... Or Almost Free
here's the thing:

i don't want to spend a lot of money in an enhanced datagrid.
do you know about any free datagrid that is better than the original one????

another question: how do the make these grids so cool????
activex control with api calls??????

thanks!

FREE Help Authoring Tool FREE
HI:

I need a tool to create help files, i heard about some that are easy to use.

anyone knows about a free one???

besides microsoft's html help workshop???

thanks

Free Library Or Free Books
Dear!
Please show me if you know where's free library or free book.

Shared Memory File - Memory Leak (URGENT)
I use a Shared Memory File, for caching data. With an ActiveX dll my applications read certain data out of the memory file.

When creating the ActiveX Object, the dll accesses the memory file in the Class_Initialize function, unmaps and closes the handle in the Class_Terminate function. After work, the Object is destroyed (Set Object = Nothing).

Whenever calling the CopyMemory API...

VB Code:
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (dest As Any, Source As Any, ByVal bytes As Long)

...from the ActiveX dll to read data from the shared memory, the used memory of the application that created the object, rises for exactly the lentgh of bytes read by the CopyMemory function, and is never released. Not even if the object is destroyed.

thanks for a fast answer.

Memory Unable To Be Read - Can VBA Perform A Memory Drop
Forum readers,

While running some of my more memory-intensive VBA macros, the program sometimes crashes because "memory unable to be read." Is there a VBA command to dump memory in between sections of my macro so it does not use up too much memory at once? I've used "Application.Wait Now + TimeValue("00:00:05")" as a way to pause the macro in between sections but I'm hoping there is a way to clear the computer's memory.

Thank you,
Brian

BitBlt: Desktop To Memory, Memory To Picbox
I'm very new to this BitBlt thing, and to graphics in general - Excel gal venturing outside VBA - so please keep your explanations on a newbie level.

I wanted to learn BitBlt, so I thought I'd write a screenshot maker and try some different approaches to see how it all works. Three out of the four things I tried work as they should. The fourth one doesn't work at all, and I cannot see why. (All four are in the attachment.)BitBlt from desktop DC to picturebox DC. That works, except it doesn't update when I resize the form and the picbox, but I understand why it doesn't, so that's fine.BitBlt from desktop DC to a memory DC and from there to picbox DC. Re-BitBlt from memory DC to picbox DC whenever the picbox is resized. This is the one that fails completely.Resize the picbox to screen size, then BitBlt from desktop DC to picbox DC. Works fine.BitBlt from desktop DC to memory BMP, copy from BMP to clipboard and from clipboard to picbox. Works fine.Since I have 2 fully workable approaches (thanks to Deadalus who helped me get this far!) I'm kind of OK, but it bothers me that I can't see why the last remaining one doesn't work. I'm probably overlooking something simple, but would appreciate help figuring out what it is.

Memory Store &amp; Memory Recall In Calculator.
Hey guys, for a project i am required to create a relatively basic Calculator. I have got the calculator with basic features, including Squared and Square root. To finish it off sufficiently i need to use Memory Store and Memory Recall functions. Now this is totally over my head, can anyone give me a pointer as to what i need to be looking at?

Many thanks,

Andy

Memory Leak Problem, How To Clear Memory?
Does anyone have code to clear memory?

My program dies after a while of usage, i need to clear the memory after each process.... hrm...

Strange Memory Leak With Memory DC
Hi, all

I'm using a memory DC to paint an image before i update the image to the screen. I use a timer to keep the image updating like this...

Code:
Private Sub tmr_Timer()
With cIP.Draw(cDC.hdc)
.Rectangle 0, 0, cDC.Width, cDC.Height, 0, vbWhite, vbWhite
If UBound(cTXT) > 0 Then
Dim A As Integer
For A = 1 To UBound(cTXT)
.Blt cTXT(A).x, cTXT(A).y, cTXT(A).Width, cTXT(A).Height, cTXT(A).hdc, 0, 0, BLT_AND
Next
End If
End With

cIP.Draw(P.hdc).Blt 0, 0, cDC.Width, cDC.Height, cDC.hdc, 0, 0, BLT_STD
End Sub

It runs fine for a while but then the graphics that im storing in my memorydc are bleeding on to either the VB IDE when im working in there or on to the desktop when i'm running my binaries.

Any ideas?

Free Up Ram
i completed the application i was asking about here
http://www.xtremevbtalk.com/showthre...189#post905189
thing is it keeps consuming ram untill it hangs the pc, are their any common methods to prevent this, or better still have some ram freed up at say 10 second intervals?
ty
peace
A

Free VB
Is there a way to optain a free version of VB, for exmple one that does not allow program compiling. Like anything with some features strip or trial period.... Thanks

Free IDE For XML
As of date, does there exist an IDE that I can write XML in so that I do not have to worry about indenting the tags for readability? Writing them in Notepad might be a good way to learn XML the hard way, but is quite a bit of a botheration.

Michael J Young mentions in his book, Step by Step XML, that we can use the Text Editor shipped with Visual Studio 6 (Visual J++, Visual C++, Visual InterDev etc.) to write properly indented XML. I searched my system but found no such tool. You guys got something to write good XML in? I have Enterprise Edition.

VB For Free???
Is there an open source VB6 style project out there like the one here for Csharp etc..?
http://www.icsharpcode.net/OpenSource/SD/Default.aspx

Thanks!

Free OCX
Hey guy,

Where could I get free ocx?

Thanks!

How To Free Ram Using Vb?
hello,

how can I free ram using vb?
anyone knows of a good demo project, or knows of a way to do this?

thanks

Free VB.Net IDe
For those wondering if they can get going on .Net without purchasing Visual Studio, and at least have a GUI....

I found this on the net, haven't played with it.... but it looks pretty well built..

http://www.icsharpcode.net/OpenSource/SD/

Free IDE For XML
As of date, does there exist an IDE that I can write XML in so that I do not have to worry about indenting the tags for readability? Writing them in Notepad might be a good way to learn XML the hard way, but is quite a bit of a botheration.

Free Up RAM
Does anyone know how to free up RAM using VB code? Programs like RAMBooster do it so I know its possible.

I think it may be to do with the windows swap file.
How can I change its settings in VB?

Is it API? RAMBooster was written in Delphi. Come on guys, MS is better than Borland/Inprise! VB must be able to do it!

Copyright 2005-08 www.BigResource.com, All rights reserved