Pelles C forum

C language => Expert questions => Topic started by: Grincheux on July 16, 2017, 08:27:38 PM

Title: Is SQLite dangerous?
Post by: Grincheux on July 16, 2017, 08:27:38 PM
In my program I use a memory database.
I launch the program and ask it to find all the images.
First time it find 250 000 images.
After one RAM was dead.
Second time, I made the same thing, it found 60 000 images.
Same result, and hard disk failed.
Third time, a research ont 43 000 images gave the same result,
and now my computer is dead!

What do you think? :-\
Title: Re: Is SQLite dangerous?
Post by: frankie on July 17, 2017, 12:06:48 PM
I think that you have to buy a better computer  :)
The use of a memory DB can't create any kind of problem, and SQLITE is absolutely safe.
What I can say is that an intensive use of the DB, 250K images, but even 43k, generate a lot of data that couldn't be contained in your PC RAM, so the OS made, as side effect, also an intensive use of disk for the buffering of the virtual memory.
If your disk was damaged, or your power supply had a problem, something bad happened to the other parts also.
Title: Re: Is SQLite dangerous?
Post by: sgraffe on October 10, 2018, 12:21:51 AM
Although this post is very old, I'd like to add the following.

When resources (like memory or disk) are scarse, the program environment becomes unreliable.

I was testing border conditions with a simple program that requested many small chunks of memory until it failed. It was supposed to print a message to a file when no more memory was available (detected through malloc() return value). The program could not write the message to the log file (which was already open) and failed in fprintf() I imagine because fprintf() needed still more memory to work.

The other resource I tested was to fill the disk with small files. When reaching the limit, I could create files of size greater than the space available (they were smaller than cluster size).

I concluded that you can issue a message "out of memory" or "out of disk" if you request a good chunk of either resource, and there is plenty of it, but not if the system is very taxed and you make a request.

So, making a memory request for a link node
struct linkNode
{
   int elem;
   struct linkNode *next;
} (size is just two words)
and malloc() returns 0? Don't worry, be happy and just exit(-1).

Regards,
Simon.