| View previous topic :: View next topic |
| Author |
Message |
Rubes_sw Valued Contributor


Joined: 11 Jun 2001 Posts: 625 Location: Northern Ireland
|
Posted: Thu Mar 20, 2003 2:30 pm Post subject: Can't figure it out ! |
|
|
I used Tommys Resource Compiler 1.3 to compile several BMPs and 2 GIFS into a resource file for my program, resource file size: 843Kb.
When i run my program using the resource file it cosumes: over 20Mb in RAM.
But when i use the original bmps and gifs in the same directory calling them directly. It Only uses 5.6 Mb
Is this a bug or i am doing something wrong?
Nathan |
|
| Back to top |
|
 |
Rubes_sw Valued Contributor


Joined: 11 Jun 2001 Posts: 625 Location: Northern Ireland
|
Posted: Thu Mar 20, 2003 2:45 pm Post subject: |
|
|
Ok, i have also tried: HASM Resource Compiler v1.0
And I left out the gifs, and just complied the bmps, same thing is happening. Roughly about 20Mb RAM being used
Is this a bug can anyone confirm, give a idea to remedy !!!
Nathan |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Thu Mar 20, 2003 2:49 pm Post subject: |
|
|
Can you give a few more technical details, i.e. how much RAM you have,
your computer manufacturer, processor speed etc., which could turn out
to be useful.
Also, how many bitmaps are you putting into the resource file and how
large are the bitmaps all together without being in a resource file. How
are you measuring the memory loss? _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
Rubes_sw Valued Contributor


Joined: 11 Jun 2001 Posts: 625 Location: Northern Ireland
|
Posted: Thu Mar 20, 2003 2:53 pm Post subject: |
|
|
OK, STATS:
I am creating a resource file called: cpc.dsr
There are: 25 Bitmaps Totaling: 797Kb (not compiled into resource file)
I am using Windows XP Pro, 240Mb Ram, 40Gb Hard Disk. 1.2Ghz Processor
I am using Windows XP Task Manager to register the memory being used.
Thanks for any help !, this is really messing my program up, Size Wise !(running)
Nathan |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Thu Mar 20, 2003 3:05 pm Post subject: |
|
|
OK, just to be sure, let's test this. I'm not exactly sure if there's 1000 bytes
in a MB or 1024 or something. But let's use 1024 because I think that's
right.
Use the following code; make sure to show the dialog, then post the
results:
| Code: | %%start_mem = @sysinfo(freemem)
REM -- Put dialog definitions here --
REM DIALOG SHOW
%%end_mem = @sysinfo(freemem)
%%loss = @fsub(%%start_mem,%%end_mem)
%%loss = @fdiv(%%loss,1024)
info There was a %%loss MB loss while using your program.
exit |
_________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Thu Mar 20, 2003 3:08 pm Post subject: |
|
|
There are 1024 bytes in a KiloByte(Kb) and 1000 KiloBytes in a MegaByte(Mb).  _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
Rubes_sw Valued Contributor


Joined: 11 Jun 2001 Posts: 625 Location: Northern Ireland
|
Posted: Thu Mar 20, 2003 3:11 pm Post subject: |
|
|
OK, when using the Resource file:
There was a 16.18359375 MB loss while using your program.
When calling the bitmaps and not the resource file:
There was a 4.91796875 MB loss while using your program.
Nathan (does this help ?) |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Thu Mar 20, 2003 3:40 pm Post subject: |
|
|
... So that means it only takes 4 MB of RAM, doesn't it?  _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
Rubes_sw Valued Contributor


Joined: 11 Jun 2001 Posts: 625 Location: Northern Ireland
|
Posted: Thu Mar 20, 2003 3:46 pm Post subject: |
|
|
Another thing the program loads faster when i do not use the resource file. (I use the bitmaps)
I can't figure it out !, it should not really consume that much resources should it ?
The main reason i want to use the resource is so that no-one can change the bitmaps my program uses, and it's tider !
Nathan |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Thu Mar 20, 2003 3:56 pm Post subject: |
|
|
I don't understand how the resource file is getting loaded into memory
anyway. Your app should only be extracting images from the resource file
as they are needed. The only thing I can figure, and I hope I'm wrong, is
the the routine that extracts the images from the resource file is not deleting
the object handles. At least if VDS were written in C/C++ that would be a
possible answer but since it's written in Delphi, I can only speculate. _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Thu Mar 20, 2003 4:01 pm Post subject: |
|
|
lol, must be braindead. Forgot to mention that the following line:
| Code: |
%%loss = @fdiv(%%loss,1024)
|
is returning Kb not Mb. For Mb it should be:
| Code: |
%%loss = @fdiv(@fdiv(%%loss,1024) ,1000)
|
And that will only work without error if the memory consumed is greater than 1000 Kb, otherwise it will generate a maths error. _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
Rubes_sw Valued Contributor


Joined: 11 Jun 2001 Posts: 625 Location: Northern Ireland
|
Posted: Thu Mar 20, 2003 4:05 pm Post subject: |
|
|
%%start_mem = @sysinfo(freemem)
returns size as Kb (as per VDS help File)
Nathan
Any help will be great on this problem ! |
|
| Back to top |
|
 |
PGWARE Web Host

Joined: 29 Dec 2001 Posts: 1565
|
Posted: Thu Mar 20, 2003 4:06 pm Post subject: |
|
|
Delphi doesn't extract the images/files to disc. It uses a TStream to read the data into a stream and sends the binary information directly to a TImage etc so it loads the bitmap/gif etc. It's a direct binary transfer from file to control.
Why not try to use the resoruce compiler that comes with the registered users pack? It's a simple commandline compiler and I know it works error free. It supports any type of file as well. |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Thu Mar 20, 2003 4:10 pm Post subject: |
|
|
I stand corrected twice. But you still aren't getting an accurate MB reading
by dividing it by 1024. If @sysinfo(freemem) returns in Kb, it must be divided
by 1000 to get Mb.
And PGWARE thanks for the Delphi lesson, I wasn't aware that that is how
Delphi deals with the resource extraction.  _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
Tommy Admin Team
Joined: 16 Nov 2002 Posts: 746 Location: The Netherlands
|
|
| Back to top |
|
 |
|