Thank You -- Thomas J. Gritzan
- From: Tom <Thomas-911@xxxxxxxxxxxxx>
- Date: Tue, 12 Sep 2006 08:42:37 GMT
Thomas -- Your suggestion to malloc() out a block of memory was the
perfect solution. Thank you kindly for your guidance.
My program now runs in 28% of the time it previously required!! :))
Almost 4 times faster!! That's a WOW in my book! Now my hard drive
only loads up data once instead of grinding away endlessly!
Below are some details of my memory issues ...
Years ago with c++ ver 1.51 I used the huge memory model and far
pointers to get beyond the 64k limits. Once I started using C++ ver
6.0 and C++ .Net the 64k limitations were no longer a factor and I
could simply use globally defined arrays of complex structures and did
not bother with malloc() because it seemed unnecessary.
As time went on I saw reference to malloc() in books discussing
objects that manage their own memory requirements ... but I thought
why bother with objects or malloc() when my program is functional?
Once I began trying to store larger and larger amounts of buffered
data to speed I/O operations by using increasingly larger arrays ...
the program would not compile. I did not understand why. The Thomas
Gritzan suggestion led me to revisit malloc() and understand that I
was exceeding the limitations of the newer C++ compilers.
I had been using the task manager to confirm the computer had reserve
memory. (I even upgraded the computer memory from 512 to 1 gig as an
attempt to solve the problem.) I knew the size of data I eventually
wanted to buffer could exceed the previously available memory ... but
I did not realize why I could not access the newer memory after I
installed it. Additionally, the compiler failure happened long before
my original 512 of memory was consumed. I was confused and simply did
not understand what the heck was going on.
As a work around solution I guessed a ram disk would solve the
problem. I had used ram disks back in the mid 80's. I posted a feel
out question in here and the off topic police were fast to type away
their frustrations in the form of telling me to go away. HAHAHA. They
would not tell me where to go ... just that I was in the wrong user
group. Some help that was not!! Why even bother telling someone they
are off topic? Just ignore the thread and go run a few miles if you
have too much frustration built up. Or better yet ... get a girl
friend instead of playing the role of off topic policeman. LMAO. If
your post is not part of the solution you are part of the pollution!
If the request seems off topic ... show off your expertise by steering
the topic towards a C based solution.
Then there is Thomas Gritzan. (The hero of this not so short story.)
He realized first what the real problem was and made the
recommendation that solved all my memory usage problems. Yeah, I was
lost and I admit it. So much so that I did not even properly define
the exact problem I had because I did not realize what it was! I was
grasping for a solution and searched the user group for a ram disk
discussion and found none. So I posted a very simple ram disk topic.
Now I am using malloc(), realloc() and free(). I am casting the
pointer output of malloc() and realloc() to match my data structure.
(The need for this casting is poorly described in the realloc() doco
in my opinion.) With new familiarity using these routines I will find
the continued transition to pure object usage much easier.
Thanks again >>> T. Gritzan <<<
Am I glad I posted a ram disk question in this group? Absolutely!! It
led the way to the best solution.
Am I working solely in a C/C++ environment? Yes. I use binary and text
files and the C/C++ environment exclusively and fail to see how
anything I attempt inside that box can be off topic.
Am I grateful to those who honestly attempted to help me with viable
code even when I initially failed even to define my operating system,
compiler, etc. Absolutely yes!! I learned Linux has some neat features
and I will consider using it sometime in the future.
Upon a revisit of my original posting do I find T.Gritzan to be the
absolutely first to use the "malloc" word. No. Another did so in a
reply to a reply of a reply. Rather deep into the thread. But their
first reply was an intentional joke and was intended to make fun of me
and not to be of any help what-so-ever. So by then I was so tuned out
that their usage of malloc and zero lack of explanation forced it into
the zero box of usefulness. Utterly ignored.
For other newbs to the group who get told they are off topic,
ridiculed, become the target of insider jokes, etc. Post away, repost,
disguise your question in a new post with a different title. Create
another user name and post again. Sooner or later a real jewel of
information might come along that is hugely beneficial. And your
persistence will frustrate the off topic police and give them a target
to vent their frustrations. If you get offended by the onslaught of
the self imposed police. Become a troll. Have some fun. Make the self
imposed want-to-be-furors scream in agony. HAHAHA. Perhaps troll under
another user name. ;) Think about that mr. policeman, because it is
you who makes trolls! duh!! LOL
- Re: Thank You -- Thomas J. Gritzan
- From: Richard Heathfield
- Re: Thank You -- Thomas J. Gritzan
- Prev by Date: Re: Smart Pointers: Is there something similar to smart pointers in C?
- Next by Date: Re: Smart Pointers: Is there something similar to smart pointers in C?
- Previous by thread: what's the effect of uppercase "S" in printf
- Next by thread: Re: Thank You -- Thomas J. Gritzan