Memory game
Posted on December 22nd, 2007
The morning was spent shopping for the biweekly groceries. This was surprisingly uneventful. While the store was rather crowded, nobody ran anyone over for once. I picked up some of the infamous $7/lbs chicken intending to have it for lunch, but we decided to visit McDonald's instead. Thus the chicken is tomorrow's lunch.

Among the things we bought was a package of frosted cookies. They won't last 'till Christmas, but they are rather good.

A good part of my evening was spent trying crazy things with memory. I'm pretty much stuck with using a 19 MB bitmap in a project, so I wanted to see just how bad things could get with large images like that. I used MS Paint to create a 191 MB image. It took about 10 minutes to save that monstrosity. I wrote a little program that loads it via the LoadImage API and tried running it. I discovered that I could have many instances of that program running with no effect on the computer. At one point there were 12 instances running -- all of which loaded the 191 MB image. That works out to over four times the memory my computer has! It seems that windows stores such images as shared memory of some kind; the cost of the image is borne by the OS, not the program that loads it.

I did some further tests to double check. I wrote a program that reads a file's contents into a buffer, waits for the user to press enter, then discards the buffer and closes. When this program tried to load the 191 MB image, it choked and the monitoring software showed that program was getting billed for each byte of the image. Thus using the API passes the buck; I guess the 19 MB image isn't such a burden. Had I known that yesterday I might have spent 3 hours doing something more productive.

I also finished reading over 2007. I may or may not get that year-end review written tomorrow.

During the evening I also remembered that I was going to look up stuff about an older Christmas movie that seems to have been largely forgotten. Since I didn't remember the name of the movie I had to track it down with guesswork, but I did find a page on it. It's called the Little Troll Prince. It's about a little troll that finds God and converts into a Gnome. If'n you wondered why people forgot about it real quick, that's all the answer you'll need to figure it out.

Lastly, this little cat video is classic. nyah nyah nyah ny--oof!

Most recent posts
Previous Post
Next Post




LJ Feed


List of UGuardian's Websites