Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
IPicture freezes
Message
De
18/01/2015 11:56:38
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Photos et traitement d'images
Titre:
IPicture freezes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01613819
Message ID:
01613819
Vues:
57
History: I have about 100.000 images on my disk, which I was happy to use in the standard screen saver. However, the screen saver had several downsides - it used only one monitor, would occasionally crash, specially if the first key pressed was left arrow (which, when it works, shows the previously displayed pictures again). Worst, its randomness is very flawed, it would display some pictures frequently and some never. Which is because every app wants to be a database when it grows up (thanks, Al, that's memorable), and it's only pretending to be one - scanning the folders below the o:\pixs only to certain depth or to a certain number of pictures per folder.

So... I started writing my own without those flaws. Made two tables, one to store folders one for pictures. In the latter, I assign each picture a score based on its size, time last seen, creation time of file, and times seen. I also store dimensions and aspect ratio, so I can pick regular (3:4 which are the majority) ones anywhere, but those more upright to the right monitor (which is vertical in my setup) and those wider to the left.

Thanks to VfpX community, LOADPICTURE( ) function has a lot of advice in the help, which i gladly used. So I'm using a

loIPic=Getinterface(LoadPicture(tcPath), "iPicture")

line every time I load a picture to display. I've noticed a slight memory leak - after a few hundreds of calls (yes, this is one of those where testing takes five times longer than development :) the memory usage would grow from initial 40M to 88M or so - which in real life means next to nothing. Now doing this for all the pictures as soon as a new, not yet scanned folder is detected is slow, so I applied that line only when a picture is to be actually displayed. Which meant that I now didn't have the aspect ratio in advance, and so many horizontally stitched images (which are a hobby of mine) would end up on the right monitor, 1080 pixels wide instead of 1920. So I decided to call it without display, behind the scene, five times for each image displayed - assuming it would finish within the 4 seconds that the timer is set to, which it did.

However, since last night, it started freezing on that line, with a "Fatal error: Exception code=C0000005" in the log, pointing to one of those behind-the-scenes calls. I guess these only add to the memory leak problem until it gets too much. What's worrying is that this used to work flawlessly for two whole nights...
Perhaps unrelated: In the app's log I've found that it did lots of .png files from skype snapshots, and I had some trouble initially with those. I regularly convert those to jpgs (as the compression is about 9 times better with no visible loss), but didn't do that from the start, and then there are also screenshots which better remain .png as better suited for the format.

Is there any function to call to garbagecollect this, or a way to flush the buffers and whatever iPicture uses? Or should I be better off using plain fox-native image objects?

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform