 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
td Guest
|
Posted: Wed May 11, 2005 5:59 pm Post subject: Images and Memory... |
|
|
Technically this is more of a memory question and less of a graphics
question, but since its graphics that are taking up all the memory, i
thought I'd see if anyone here had any suggestions...
So, i've written myself an image catalog application with a fancy thumbnail
view, email, export and some minimalist editting functionality. The
thumbnail view loads all the jpeg thumbnails from a database into memory.
And with 5000 or so images, its really not that bad, the jpegs are nicely
compressed and i think it takes maybe 50-70MB. But, as you scroll the
thumbnails, and paint them to the screen, they are decompressed and the
amount of memory grows considerably.
I couldnt find a way to just throw away the bitmap (or DDB or whatever its
called) part of the tjpegimage, without freeing and reloading the jpeg. So
i wrote myself a little cache class, thats keeps the top (ie last painted) n
images in memory and frees the oldest images when needed. And that works
fine too.
And now we come to my question: Is there any way to come up with a good "n".
Are there ways to monitor memory usage and keep it under some limit. How do
you come up with a limit. And how do you deal with your application being
minimized and the user firing up some other app that wants a bunch of
memory?
Any thoughts/ideas appreciated...
Thanks,
Trevor
|
|
| Back to top |
|
 |
Michael Mattsson Guest
|
Posted: Thu May 12, 2005 1:19 am Post subject: Re: Images and Memory... |
|
|
| Quote: | "Is there any way to come up with a good 'n'.
|
Yes. But as with everything, it depends on your customer's requirements and
expectations.
the number of thumbnails you have loaded in memory at any one time should be
based on a number of variables
-available memory
-available resources (only critical if using win95 - it has handle issues)
-minimumm thumbnail display delay the customer will except.
-maximum memory the customer willing to devote to your running app
After you come up with your 'N' value based on the above variables, you
might want to let the customer adjust those variables in an options dialog -
this will allow them to tweak it to their own liking - and will save you a
few headaches comming up with a perfect "n" value.
| Quote: | Are there ways to monitor memory usage and keep it under some limit.
|
Your own image cache/display routine should be tracking memory usage, and
limiting the amount of memory used.
| Quote: | And how do you deal with your application being minimized and the user
firing up some other app that wants a bunch of memory?
|
You don't. You let the operating system handle system level memory
management. If your app is minimized and the OS requires memory for another
app, then your application stack will get swapped out to disk
automagically....
cheers,
Michael
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|