|
-
Nov 24th, 2000, 07:32 AM
#1
Thread Starter
Fanatic Member
Hi. I've got myself a large-ish project here, with:
33 Forms - Largest 62kb, total 412kb
41 Modules - Largest 28kb, total 475kb
My computer is a 350 P2, with 128mb 100mhz SDRam. The only things it loads on startup (other than system crap) are a tiny little app called WinTidy, DirectCD and Office 97 Shortcut bar.
However, if I were, say to go online and get my emails (just retrieve them - not open), or open Excel and look at a spreadsheet, and then close all this and open my project, VB gives me the message "Out of memory", and whilst it will sort of function, I can't compile my project (which would normally result in a 2.2Mb exe).
Even if I open VB6 immediately on startup, without running anything else first, and I view say three or four of the forms in my project, I still get the "Out of memory" message.
So:
Is 128Mb RAM not enough in this instance?
Will adding another 128Mb fix the problem?
I have SP3 - do I need to get SP4?
Can I stop crying yet?
Cheers...!
-
Nov 24th, 2000, 07:40 AM
#2
Fanatic Member
-
Nov 24th, 2000, 07:49 AM
#3
Thread Starter
Fanatic Member
hi, I'm on Win95 - I'd love to upgrade, but daren't coz that's what the users are on. I'm slightly nervous of installing SP4 coz I have to email updates, and currently (so long as I don't add any more components) I can just zip and email the exe.
-
Nov 24th, 2000, 08:29 AM
#4
Hyperactive Member
break your project out into several dlls. I doubt it's the size of the files (sum) thats the problem. The IDE gets easily confused with large number of components (if you've ever tried playing with procedure attributes on large projects, you'll know what i'm talking about).
td.
"One logical slip and an entire scientific edifice comes tumbling down." - Robert M. Pirsig
[email protected]
"but if Einstein is right and God is in the details, reality requires that we sometimes get religion." - Scott Meyers.
-
Nov 24th, 2000, 08:38 AM
#5
Part of the problem could be that you are either usingthe API for graphics work and no releasing you DC handles, or more lilely, you are not releasing the memory that your objects are using up.
Anything that you declare by using the new keyword (eg Dim X as MyObject, then Set X = new MyObject), needs to be released once you've finshed with it by going "Set X = nothing")
- gaffa
-
Nov 24th, 2000, 08:44 AM
#6
Lively Member
hi,
what's ur size of ur harddisk try keeping freespace of about 100mb and try it delete files from ur windows temp folder and check or else do as tumblingdown mentioned.
-
Nov 24th, 2000, 08:51 AM
#7
Hyperactive Member
gaffa, he's saying he can't compile, so it's not a runtime issue.
td.
"One logical slip and an entire scientific edifice comes tumbling down." - Robert M. Pirsig
[email protected]
"but if Einstein is right and God is in the details, reality requires that we sometimes get religion." - Scott Meyers.
-
Nov 24th, 2000, 09:01 AM
#8
Thanks td.
I thought he did when I first read the thread, but I re-read it and must have missed the compile reference. Ooops.
That error was fixed (I believe in the latest service pack (or it could have been SP3). Either way I recall reading something about it in the MSDN
On another note, I would have expected a project that size (41 modules) to implement at least some classes form a desing point of view. Admittedly, I know nothing about the project, but 41 modules and 0 classes seems rather excessive.
cheers
- gaffa
-
Nov 24th, 2000, 09:15 AM
#9
Hyperactive Member
Coox,
Gaffa's right. 41 modules in a single project is, well, err,...;-)
Can you not rationalise what you have a put in place a class based structure?
td.
"One logical slip and an entire scientific edifice comes tumbling down." - Robert M. Pirsig
[email protected]
"but if Einstein is right and God is in the details, reality requires that we sometimes get religion." - Scott Meyers.
-
Nov 24th, 2000, 09:16 AM
#10
Hyperactive Member
... you could then 'prove' various bits of functionality, then carve them out to seperate dll's. Then your handling smaller chunks of code at a time.
td.
"One logical slip and an entire scientific edifice comes tumbling down." - Robert M. Pirsig
[email protected]
"but if Einstein is right and God is in the details, reality requires that we sometimes get religion." - Scott Meyers.
-
Nov 24th, 2000, 09:20 AM
#11
Thread Starter
Fanatic Member
Probably - trouble is though, I've no idea what classes are... fancy giving me a quick overview?
I knew someone was going to have a go at me for having so many modules.
-
Nov 24th, 2000, 09:37 AM
#12
Lively Member
hi,
it's not so easy to give a quick overview on class refer Dan Applemans ActiveX/Com componets it's a good copy
-
Nov 24th, 2000, 09:40 AM
#13
A class is a way of "encapsulating" (to use the corect termiology) all data and functions that act on that data in a nice little package.
Say for example you had a module, and in that module (we'll call it modPerson) you had a type eg:
Code:
Public Type Person
Name as String
Age as Long
HairColour as String
End Type
and you had a few functions that you passed that type into, like a function called IsOldEnoughToDrink, and IsAPensioner
Those functions, and the data type Person relate to each other. And say you wanted to store four different Persons in your system at once.
You would either create four variable opf type person, then when you wanted to see if one person is old enough to drink, then you would say:
Code:
lResult = IsOldEnoughToDrink(mvarPerson1)
By putting all this into a class, you could use the code below instead (which reads a lot nicer)
Dim mobjPerson as clsPerson
Set mobjPerson = new clsPerson
lResult = mobjPerson.IsOldEnoughToDrink
[/code]
Ok, that's a pretty simplistic example, but you can make very powerful things with classes. the beuaty of them is that because they encapsulate data, and have their own internal functions, you can create as many instances of person as you want, and each person object (class) will have it own IsPersonOldEnoughToDrink function.
This means that you can store data in a much friendlier way, and you can write classes to do funky helper things. I have a series of classes that are wrappers around the standard controls.
An example of this (and this class isn't very complex), is the following code that "wraps" around a combo box.
The following lines load a combo from a database, fill the item data, make it dropdown the list bit when the combo gets focus, makes the dropdown bit wdie enought to display all the data that is wider than the actual combo amd returns values from the combo in a much nicer syntax than normal
Code:
mComboMajorClass.Display cmbMajorClass, "tblMajorClass", Connection, "Code", "IDMajorClass", , , True
mComboMajorClass.AutoDropdownCombo = True
I access the combo through the class, not through the combobox iteself eg:
Code:
'to get the selected items itemdata
mComboMajorClass.SelectedItemData
'to get the selected items text
mComboMajorClass.SelectedText
'Add an item and some related item data, and make that item
'the default item
mComboMajorClass.AddItem "Test", 1, True
'Tell me if the default item is selected
mComboMajorClass.DefaultItemIsSelected
'Set the default item to be display
mComboMajorClass.SetToDefault
THe default item I talk about is a database thing - a certain row in the talbe MajorClass is specified as the default.
Basically, look up the MSDN, and read as much as you can. Classes are the tning that will convert you from an OK VB programmer to a really good programmer.
I'm not sure how well I've explained it, but at least I tried 
- gaffa
-
Nov 24th, 2000, 10:01 AM
#14
Hyperactive Member
Here is a simplistic way to start of. (btw, this works for designing simplistic Relational Databases also)
- Look at what it is your system does (is supposed to do).
- Think about what logical objects may exist. This is the most important step.
In an Company HR system, you may have logical objects like Person and Department. - Think about what properties or attributes that those objects may have.
A Person has attributes like Name, Age, Salary.
A department has propeties like the Number of employess in that department. - Think about how the objects interact. What methods do you wnat to perfom on these objects.
A You may have a method for Dept that tells how much the cost base (in salaries) of the employees in that Dept. - Define rules on the interations that your objects have.
Only People of a certain Age may work in certain Departments. - Read some cool books;-)
Don't know if this is any help or not.
Probably the most fulling part of this is the first bit (apart from giving your objects life, and letting them wonder off into the world), thinking about what objects exist in your system.
td.
"One logical slip and an entire scientific edifice comes tumbling down." - Robert M. Pirsig
[email protected]
"but if Einstein is right and God is in the details, reality requires that we sometimes get religion." - Scott Meyers.
-
Nov 24th, 2000, 11:36 AM
#15
Frenzied Member
See Tomexx Post
Yonatan posted a reply to a Tomexx post asking about classes.
It was a very simple and clear example which provides initial insight into what classes are about. It is a good starting point.
I found it using "Yonatan" & "mydog" as search terms.
Live long & prosper.
The Dinosaur from prehistoric era prior to computers.
Eschew obfuscation!
If a billion people believe a foolish idea, it is still a foolish idea!
VB.net 2010 Express
64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.
-
Nov 24th, 2000, 12:25 PM
#16
Thread Starter
Fanatic Member
Thanks everybody - given me lots to think about...
-
Nov 24th, 2000, 12:39 PM
#17
Member
OK, I know many people don't read throught thousands of pages
in the Microsoft Developer's Guide Handbook..
But in case you do, did you read that about VB Restrictions?
If I am not wrong VB is limited to 32,000 identifiers, module cannot be more then 65,534 lines, lots more..If you got
the VB Programmer's Guide ..Check out page "846".
If you got Out-Of-Memory..I think it's because..NO DUH!
Your big ass project!
Using Visual Studio 6 Enterprise
---------------------------------
Everyone needs help at some point..
This time or another.
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
|