|
-
Mar 27th, 2002, 09:11 PM
#1
Thread Starter
Fanatic Member
Memory eaters
Haveing finaly gotten P'd off with VBs memory munching I installed a RAM LIBERATOR program. It fixed the problem that's for sure - not very satisfying.
But it seems VB is not the only MS product that takes RAM and then wont give it back.
Even the MSN website does it (!)
Are microsoft out to prove PCs are crap or is it a fundamentle difference between what they think we use and what we do use?
Have noticed VB is nasty for it though. It wants all my spare memory and what for? does it need it? NO!
I recon one day MS will slip up and forget to include the memory hog modual in a program.
Sorry pet peeve. does anyone know how to limit the VB packages damage on memory munching when it's been loaded a few hours a giant hole appears in my memory and it all leaks out. I haven't got that much anyway.
-
Mar 28th, 2002, 01:29 PM
#2
sounds like you aren't closing your program right or some functions.
but it could also be a memory resident program that sits in the back of the memory just eating, can't remember the name for those.
-
Mar 28th, 2002, 01:40 PM
#3
Fanatic Member
Originally posted by scoutt
sounds like you aren't closing your program right or some functions.
but it could also be a memory resident program that sits in the back of the memory just eating, can't remember the name for those.
well the programs you make in VB have alot of overhead and clunky memory management
how much ram do you have matt? i use vc++/vb (not anymore now, but when i did), and the msdn site took up almost no memory at all, and whatever it used it gave back to me. your prolly running some bloatware that you dont know know. check your startup.
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Mar 28th, 2002, 06:30 PM
#4
VB makes extensive use of the SCM (the thing that actually maps memory for COM servers into process space).
The SCM has a 'feature' that certain kinds of objects are cached in memory. And persist after image exit. You'll notice this if you start IE5 or Word, then exit the apps. The available memory is less than when you started.
The assumption is that other microsoft apps that you are going to start will need the objects - which is true only if you fire up more MS products.
If the amount of memory contiues to go down with each run of the app, then you have a memory leak.
-
Mar 28th, 2002, 06:41 PM
#5
Thread Starter
Fanatic Member
This is all sounds chillingly familiar.
Question is what should I do about it? What can I do about it. Operating systems and the hardwear eliment of computers are not my strong point. I've only given them seriouse study in the last year.
-
Mar 29th, 2002, 10:16 AM
#6
There isn't much you can do about what the SCM persists in memory, except make sure that you close down VB programs correctly.
eg. things like:
Code:
Dim o as object
for each o in Forms
unload o
next
-
Mar 31st, 2002, 08:29 AM
#7
Thread Starter
Fanatic Member
Ok thanx, Iguess it's just one of those things that'll have ta live with.
BTW: is that "code" 4 real?
Dim o as object
for each o in Forms
unload o
next
-
Mar 31st, 2002, 08:52 AM
#8
Good Ol' Platypus
There are certain API calls that cause huge memory leaks.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Mar 31st, 2002, 09:26 AM
#9
Thread Starter
Fanatic Member
API functions?? I C!
Any idea what these could be?
I'm not to fussed if you can't tell me but.... you know 'twould be usefull to keep in mind.
-
Mar 31st, 2002, 11:01 AM
#10
No api causes a memory leak when you use it correctly. But if you call CoTaskMemAlloc and forget to call CoTaskMemFree you can be in a world of hurt, for example.
The problem here is that you may not KNOW that you call CoTaskMemAlloc, because you called it indirectly.
For instance:
Code:
Private Type BrowseInfo
hWndOwner As Long
pIDLRoot As Long
pszDisplayName As Long
lpszTitle As Long
ulFlags As Long
lpfnCallback As Long
lParam As Long
iImage As Long
End Type
Const BIF_RETURNONLYFSDIRS = 1
Const MAX_PATH = 260
Private Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal hMem As Long)
Private Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" (ByVal lpString1 As String, ByVal lpString2 As String) As Long
Private Declare Function SHBrowseForFolder Lib "shell32" (lpbi As BrowseInfo) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32" (ByVal pidList As Long, ByVal lpBuffer As String) As Long
Private Sub Form_Load()
'KPD-Team 1998
'URL: http://www.allapi.net/
'[email protected]
Dim iNull As Integer, lpIDList As Long, lResult As Long
Dim sPath As String, udtBI As BrowseInfo
With udtBI
'Set the owner window
.hWndOwner = Me.hWnd
'lstrcat appends the two strings and returns the memory address
.lpszTitle = lstrcat("C:\", "")
'Return only if the user selected a directory
.ulFlags = BIF_RETURNONLYFSDIRS
End With
'Show the 'Browse for folder' dialog
lpIDList = SHBrowseForFolder(udtBI)
If lpIDList Then
sPath = String$(MAX_PATH, 0)
'Get the path from the IDList
SHGetPathFromIDList lpIDList, sPath
'free the block of memory
CoTaskMemFree lpIDList
iNull = InStr(sPath, vbNullChar)
If iNull Then
sPath = Left$(sPath, iNull - 1)
End If
End If
MsgBox sPath
End Sub
-
Apr 8th, 2002, 09:42 AM
#11
Thread Starter
Fanatic Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|