Mike Williams
9/26/2011 12:37:00 PM
"BeeJ" <nospam@spamnot.com> wrote in message
news:j5oh26$ens$1@speranza.aioe.org...
> The code snippet above will help with this next memory overrun
> problem but it will take me another few days to get to it.
Well, like Nigel said, knowing how much memory you've got left is not quite
the same as knowing whether you are going to get a memory error. It just
tells you how much memory you have left, not how big the largest contiguous
block might be. I posted it simply because you asked how to do such a thing.
In your particular case (redimensioning arrays of strings and then
populating the added elements with string data), the smaller the individual
strings are the more likely you are to get a memory error whilst there is
actually still a significant amount of memory left. That's because it is the
list of string pointers for the array which need a contiguous block of
memory, rather than the string data itself, and the smaller the strings are
then the larger the list of pointers will be by the time you start getting
near your memory limits. In such cases you are likely to get an "Out of
memory" error, and get it whilst there is actually a significant amount of
memory left, whereas doing a similar thing with very large strings you are
more likely to get an "Out of String Space" error and get fairly close to
the memory limit. Having said that, if you are getting anywhere near the
memory limits in your program then perhaps it is time to look again at what
you are doing and to see if it can be done in a less memory intensive way.
> I need to wind up with two arrays that are blank in one with a
> mismatch with the other (the other retains the value) and a same
> values in both when they match.
Well, that's about as clear as mud ;-) Perhaps it is time to give an
outline of what you are actually doing (the reason behind it all) rather
than the details of how you are doing it. For example, in one of your posts
I think you said that you were loading and sorting very large arrays of
Strings, each of which is the string representation of an integer? I don't
know where you are pulling this string data from, nor why it is in that
particular format, but surely you don't need to hold it in that format in
your arrays? Why can't you convert to integers as you load it and then
convert back to string representation after you have analyzed and sorted it
or whatever and when you want to save it back? Why can't you work like that?
> RAM drive? Since I am storing and retrieving strings and
> the they are variable length so ...? And RAM drive would
> be faster, yes?
It depends on the machine. On many machines a RAM drive can actually be self
defeating. It's horses for courses.
Mike