Memory usage in Delphi 2007 vs. Delphi 5

Going from Delphi 5 to Delphi 2007 and finding something way unexpected.

The reportedly *same code, and same data,* uses about 104 MB in Delphi 5 
and about 400 MB in Delphi 2007 according to the Windows Task Manager. 
Now, I know that it is not the most accurate way of measuring memory 
usage, but it gives us an idea of the proportion of memory use in Delphi 
2007.

Before we go deeper, we just created 20,000 objects and added them to an 
object list in Delphi 5 and 2007.  The result in memory use still looks 
like  50 MB (Delphi 5) to 178 MB (Delphi 2007).

We've downloaded a copy of AQTime to check this further but, has this 
type of problem been seen or reported at all?  Remember, same code (and 
we are not doing anything but create and add to a list -- not data 
loading) shows that much difference.

Any ideas why?

-- 
- Eduardo
In theory, there is no difference between theory
and practice. But, in practice, there is.
   -- Jan L.A. van de Snepcheut

Eduardo A. Salgado
OneDomain, Inc.
eas@OneDomain.com
0
Eduardo
9/18/2009 8:10:54 PM
embarcadero.delphi.non-tech 5933 articles. 1 followers. Follow

15 Replies
1322 Views

Similar Articles

[PageSpeed] 36

"Eduardo A. Salgado" <eas@onedomain.com> wrote in message 
news:163699@forums.codegear.com...
> Going from Delphi 5 to Delphi 2007 and finding something way unexpected.
>
> The reportedly *same code, and same data,* uses about 104 MB in Delphi 5
> and about 400 MB in Delphi 2007 according to the Windows Task Manager.
> Now, I know that it is not the most accurate way of measuring memory
> usage, but it gives us an idea of the proportion of memory use in Delphi
> 2007.
>


The memory managers in Delphi 5 and 2007 are very different. It may have 
something to do with the MM pre-allocating blocks in its cache.  You could 
try downloading FastMM (the MM used in Delphi 2007) for Delphi 5 and compare 
the memory usage in the D5 version of the app with this MM linked in.  It'll 
only take the addition of a single line of code to you project source in 
order to test this.

You can download FastMM from SourceForge 
http://sourceforge.net/projects/fastmm/

Dave White
0
Dave
9/18/2009 9:43:09 PM
Eduardo A. Salgado wrote:

>  Remember, same code (and 
> we are not doing anything but create and add to a list -- not data 
> loading) shows that much difference.

Well, it's not the same code.  The VCL and the RTL have been expanded
in capabilties since Delphi 5.  Now I don't know specifically what your
code is doing, but it is likely a result of all the new functionality
built into the VCL and the RTL.

-- 
Nick Hodges
Delphi Development Manager
Embarcadero Technologies
0
Nick
9/18/2009 9:46:19 PM
Dave White wrote:

> 
> The memory managers in Delphi 5 and 2007 are very different. 

Good point -- and this is something that could be more efficient, but
reflect differently in the widely unuseful Task Manager memory display.

-- 
Nick Hodges
Delphi Development Manager
Embarcadero Technologies
0
Nick
9/18/2009 10:22:02 PM
> Well, it's not the same code.  The VCL and the RTL have been expanded
> in capabilties since Delphi 5.  Now I don't know specifically what your
> code is doing, but it is likely a result of all the new functionality
> built into the VCL and the RTL.

Are you going to scare and drive customers away? 8-O

What damned functionalities you may have added to up memory use by a factor of  four? Given you role at Embarcadero, you should be more careful when answering.
0
Luigi
9/20/2009 9:06:12 PM
> Any ideas why?

FastMM has much more "debugging" functions than the old memory manager used in D5. To catch leaks, it has to keep track of memory usage, and other checks for other kind of memory errors (i.e. overwriteng an area). They could  keep memory allocated to the process even when not in use by the applcation. Try to compile the 2007 executable in "release" configuration and configure FastMM accordingly (there should be some global variables, and the "standalone" FastMM library has several defines that control how
 it works). Also use SysInternal's Process Explorer for a better view over process memory.
0
Luigi
9/20/2009 9:11:05 PM
Dave White wrote:
> The memory managers in Delphi 5 and 2007 are very different. 

My bad.  We are using FastMM 4.9 in Delphi 5 and the memory manager in 
2007 is the CodeGear version of Fast MM.


-- 
- Eduardo
In theory, there is no difference between theory
and practice. But, in practice, there is.
   -- Jan L.A. van de Snepcheut

Eduardo A. Salgado
OneDomain, Inc.
eas@OneDomain.com
0
Eduardo
9/21/2009 1:59:21 PM
Nick Hodges wrote:

> Well, it's not the same code.  The VCL and the RTL have been expanded
> in capabilties since Delphi 5.  Now I don't know specifically what your
> code is doing, but it is likely a result of all the new functionality
> built into the VCL and the RTL.
> 
Right, Nick.  What I meant with the "same code" is that it is reportedly 
the same code used for the Delphi 5 and 2007 builds.  IOW, the code does 
not do any database or GUI stuff that may have needed to change from one
version to the other.  And the PAS files are the same, just in a 
different directory.

I say reportedly because it is someone else's code.  From what I have 
checked, it is exactly the same code.

For testing, we isolated a sample that just created an object list (in 
out case TOdi object list) and then added some 20,0000 TOdi objects. 
That is it. Empty objects into an object list.  And the memory went crazy.

We have been getting problems with running out of memory and having to 
page to disk. That is what got us to see what had changed.


-- 
- Eduardo
In theory, there is no difference between theory
and practice. But, in practice, there is.
   -- Jan L.A. van de Snepcheut

Eduardo A. Salgado
OneDomain, Inc.
eas@OneDomain.com
0
Eduardo
9/21/2009 2:09:57 PM
Eduardo A. Salgado wrote:

> The reportedly *same code, and same data,* uses about 104 MB in
> Delphi 5 and about 400 MB in Delphi 2007 according to the Windows
> Task Manager.  Now, I know that it is not the most accurate way of
> measuring memory usage, 

	Correct.

> but it gives us an idea of the proportion of
> memory use in Delphi 2007.

	Incorrect.

	Using the right tool (process explorer) will give better results.
Start with private bytes in PE.

-- 
Craig Stuntz · Vertex Systems Corp. · Columbus, OH
Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz/
0
Craig
9/21/2009 2:13:27 PM
Luigi Sandon wrote:
>> Any ideas why?
> 
> FastMM has much more "debugging" functions than the old memory manager used in D5. To catch leaks, it has to keep track of memory usage, and other checks for other kind of memory errors (i.e. overwriteng an area). They could  keep memory allocated to the process even when not in use by the applcation. Try to compile the 2007 executable in "release" configuration and configure FastMM accordingly (there should be some global variables, and the "standalone" FastMM library has several defines that control h
ow
>  it works). Also use SysInternal's Process Explorer for a better view over process memory.

Here is the deal.  No "memory leaks" are apparent.

IOW, when we free the objects and terminate the application we get the 
same amount of memory available from the test app in both D5 and D2k7.

non sequitur (or "does not compute").

-- 
- Eduardo
In theory, there is no difference between theory
and practice. But, in practice, there is.
   -- Jan L.A. van de Snepcheut

Eduardo A. Salgado
OneDomain, Inc.
eas@OneDomain.com
0
Eduardo
9/21/2009 2:20:19 PM
Eduardo A. Salgado wrote:
> Before we go deeper, we just created 20,000 objects and added them to an 
> object list in Delphi 5 and 2007.  The result in memory use still looks 
> like  50 MB (Delphi 5) to 178 MB (Delphi 2007).
> 

	What kind of objects? What kind of data? Could it be at least partly
caused by different memory usage of ansistring (in Delphi 5) and
unicodestring (Delphi 2007)? And what column were you looking at Task
Manager? Mem Usage? VM Size?

-- 
Virgo Pärna
virgo.parna@mail.ee
0
Utf
9/22/2009 12:04:24 PM
Virgo Pärna wrote:
> Eduardo A. Salgado wrote:
>> Before we go deeper, we just created 20,000 objects and added them to an
>> object list in Delphi 5 and 2007.  The result in memory use still looks
>> like  50 MB (Delphi 5) to 178 MB (Delphi 2007).
>>

To paraphrase, we have found the enemy and he is us.

We use and love EurekaLog.

As it turns out, a new feature of EurekaLog has been the culprit behind 
our memory and speed issues.  We had turned on this new feature, Memory 
Leak Detection, when migrating to D2007 in the hopes that it would help 
us find memory leaks (which it has).  Unfortunately, this feature causes 
the EXE to take up a substantial amount more memory than it normally 
does.  It also slows down the application as it tracks every memory 
request the software makes.  In D5 it had been turned off long ago.

When we finally turned it off for D2007, the memory of our application 
went from 170 MB to 59 MB.  And it flies, like it used to in D5 or even 
more so.  We now have a slimmer, faster, system than we had with Delphi 5!

In the words of Roseanne Roseannadanna, "Oh. That's very different. 
Never Mind." :-)

-- 
- Eduardo
In theory, there is no difference between theory
and practice. But, in practice, there is.
   -- Jan L.A. van de Snepcheut

Eduardo A. Salgado
OneDomain, Inc.
eas@OneDomain.com
0
Eduardo
1/14/2010 11:24:48 PM
Kevin Powick wrote:
> On 2010-01-14 18:24:48 -0500, Eduardo A. Salgado <eas@onedomain.com> said:
> 
> 
>> In the words of Roseanne Roseannadanna, "Oh. That's very different.
>> Never Mind." :-)
> 
> I wonder how many people remember Gilda these days?  It's been close to 
> 21 years.
> 
> --
> Kevin Powick


Actually, my wife and I were talking about her just a couple of days ago 
(in the context of a discussion of actors who've died young, said 
discussion triggered by the death of Brittany Murphy).

David Erbas-White

P.S. "Delphi" -- there, it's on topic...
0
David
1/15/2010 2:05:43 AM
On 2010-01-14 18:24:48 -0500, Eduardo A. Salgado <eas@onedomain.com> said:


> In the words of Roseanne Roseannadanna, "Oh. That's very different.
> Never Mind." :-)

I wonder how many people remember Gilda these days?  It's been close to 
21 years.

Edit: Btw, it was her hard of hearing character  "Emily Litella" that often used the quote you referenced.

--
Kevin Powick
0
Kevin
1/15/2010 2:09:08 AM
Hello,

why not use the built in FastMM for memory leak detection?
The simplest was is to write

ReportMemoryLeaksOnShutdown:=true;

as first command in your .dpr file. When your app is closed and there
was a memory leak a small message box tells you something about.

If you need more detail you can download and use the full FastMM which
can give you detailed reports without sacrifying performance. Only the
very aggressive hardcore detection routines will cause a huge penalty,
but I only needed those in a single hard case.

Greetings

Markus
0
Markus
1/15/2010 7:33:29 PM
Markus Humm wrote:
> why not use the built in FastMM for memory leak detection?

We did all that, even used AQTime.  But there was no real memory leak.

The reason why the memory foot print was way different in D5 and D2007 
was a mistake we made in a switch in Eurekalog.  The D5 version had been 
developed a long time ago and the switch was off.  For the new version 
in D2007, we had turned on the switch for development and forgot to turn 
it off.

We use and love Eurekalog and would not live without it. But it was the 
last place we looked when trying to find what was going wrong.  Our bad.

Now, all is good with the world.

-- 
- Eduardo
In theory, there is no difference between theory
and practice. But, in practice, there is.
   -- Jan L.A. van de Snepcheut

Eduardo A. Salgado
OneDomain, Inc.
eas@OneDomain.com
0
Eduardo
1/18/2010 6:27:49 PM
Reply:

Similar Artilces:

Project Manager Delphi 2007 vs Delphi 5
I am in the midst of moving from Delphi 5 to Delphi 2007. I have a .BAT file that I use to do some post processing on the executable after it is built. In Delphi 5, I just added the .BAT file to the project manager. Then when I wanted to execute the .BAT file I just right clicked its entry in the project manager and selected Execute. There doesn't seem to be anyway to add the .BAT file to the project manager in Delphi 2007. How can I set up something similar to what I had in Delphi 5? I thought about using a Post Build event but I don't necessarily want to execute the .BAT fi...

Delphi 5 (string[80]) vs Delphi XE
Hi guys i'm trying to convert a old application made with Delphi 5 to Delphi XE 5 The probleme i have right now is about String[80] and the Read / Write procedure i have a type like that Type TEnrMess = record Mess : String[80]; MessSuiv : Word; Hint : Word; end; And i read/write this type to a File of TEnrMess My probleme is that the string have changed from Delphi 5 to Delphi XE i join the link of a simple of the probleme that can be compiled on delphi 5 and any Delphi XE https://mega.co.nz/#!wV1VyZzY!1ha5oOxTg7L1WJAOXutUygkj...

Delphi 5 to Delphi XE4
Thinking about making the conversion. Of course we have numerous components such as: TurboPower AsyncPro, TurboPower Orpheus ICS2 Synactis All-In-The-Box. You guys have any advice as to the effort and time it may possibly take. It is a large application, several hundred thousand lines. And that's what happens when using third party components, a lot of extra work. I have been burned a few times. I now minimize the use to a few well known suppliers, like TMS. I have "banned" a lot of other components. Regards, Ole > > Thinking about making the conver...

Delphi 5 to Delphi 6 and up
Dear List, Trying to add 7Zip compression support to my delphi application. I am using the ported 7Zip sdk (see their website, they have a link). I am stumped on how to rewrite a single function: function ReverseDecode(var Models: array of SmallInt; ....): ..... where the input is mostly a fixed size array of SmallInt. This code perfectly compiles and functions in Delphi 6 and up, but in Delphi 5 I get the error: There is no overloaded version of 'ReverseDecode' that can be called with these arguments And obviously, the input (fixed) isn't the same as the param de...

Delphi 4 to Delphi 2007
Hello, I will have to port a D4 application (with source) to D2007. what kind of problem could I face ? I will have to go to customer site tommorow to analyse its source code to quote the work, what should I care of to hestimate the porting time ? Thanks John Terry wrote: > Hello, > I will have to port a D4 application (with source) to D2007. > what kind of problem could I face ? > I will have to go to customer site tommorow to analyse its source code > to quote the work, what should I care of to hestimate the porting time ? You can probably do it by just changi...

Delphi 2007 to Delphi 7
I've written a class in Delphi 2007 that is not supported in Delphi 7. What would be the best way to achive what I've done in Delphi 2007 in Delphi 7? Thanks, Tom type BondConstants = class { Bond Types } type BondType = record const TREASURY = 3; AGENCY = 0; CORP = 1; MUNI = 2; SBA = 5; MBS = 4; CMO = 6; end; { Day Count Methods } type DayCount = record const ACTUAL_360 = 2; ACTUAL_365 = 1; ACTUAL_ACTUAL = 1; d30_360 = 0; ...

Delphi 5 To Delphi 2009
I upgraded to Delphi 2009 from D5. The install says I can install Delphi and/or C++. Delphi installed OK but I see nothing of C++. What am I missing or does my upgrade not include C++? Thanks It depends on what you bought. If you bought Delphi 2009 only, that's what you get. If you bought Delphi 2009 and C++ Builder 2009 you get both. My guess is you got Delphi 2009 only. The simplest way to verify is look your invoice - it should say I would think. You could also go to members.embarcadero.com, login, then click on my registered products. There will be a textual description of...

Converting Delphi 2007 Indy 10.2.3 to Delphi 2009 Indy 10.5.5 [Edit]
Hello, I am currently attempting to port over a Delphi 2007 project that uses Indy 10.2.3 (very successfully) to Delphi 2009 and Indy 10.5.5 (I just got the latest development build this morning). I think I am running into an encoding issue, but am not sure. Specifically, IDHTTP with SSL calls an old CGI and the CGI returns a .zip file and I then save it to the disk. In 2007 and before this worked perfectly. In 2009, it is not. Here is the examples of the 2 different results (though cut way short in the post) I am getting back: 2007: 'PK'#3#4#$14#0#0#0#8#0'rLQ9žrPb€'#0...

SEPA components for Delphi with Source Code (Delphi 5
Hi all, in the european union change next year the Bankingformat to the SEPA Format. All peoples and companies must change the bankingssoftware and the costumer data form acountnummers in the new IBAN and BIC numbers. See: http://www.arma-it.de/shop/artikelueber.php?wgruppeid=211&wgruppe_offen=211 Functions: - generate SEPA XML'S - Calc IBAN - BIC Database (DE,AT and CH) Questions: vertrieb@arma-it.de PS: Bankinssoftware for Develpoers (Germany only) http://www.arma-it.de/shop/artikelueber.php?wgruppeid=212&wgruppe_offen=212 El 26/10/13 21:38, A...

Convert Delphi 5 ADO App to Delphi 2007 ADO.NET
I have an appliction tha that is writen in Delphi 5 with ADOConnetion, ADOTable, and ADOQuery components. I need to upgrade to Delphi 2007 and use ADO.NET. I have the program building in with Delphi 2007. Is there anything I need to do to convert the ADO to ADO.NET? > I need to upgrade to Delphi 2007 and use ADO.NET. Why ? -- With best regards, Dmitry Arefiev AnyDAC (www.anydac.com) - Oracle, MS SQL Server, IBM DB2, MySQL, Firebird, Interbase, PostgreSQL, Sybase ASA, SQLite, MS Access, DBX, ODBC, InMem - universal high-speed native data access engine Reasons for ...

Problem with Delphi 2007
Ok - I have been using Delphi 2007 for a wihle. I also have Delphi 2009 on the same machine for a while as well. I use both of them on a regular basis. I have Eureka log - and Castalia installed - each for a couple of months. A few days ago I installed Raize Code site (full version) - but I am not using it in my projects yet... Today - I am having the strangest thing happen. As I type in the Delphi editor - every 5 characters - the memory usage climbs by 0.01 GB. (Yes - 5 typed characters take up 10 MB of memory... HUH!!) I have rebooted the machine - shut down and restar...

Delphi and Delphi for .Net
It seems that Delphi for .Net is slower than Delphi Win32 native applicaiton. I would like to know is it true all .Net application is slower than Win32 native applicaiton or it is Delphi for .Net only. Your information is great appreciated, Inung On 2011-06-21 18:20:17 +0100, Inung Huang said: > It seems that Delphi for .Net is slower than Delphi Win32 native applicaiton. > I would like to know is it true all .Net application is slower than > Win32 native applicaiton or it is Delphi for .Net only. If you are only running the code in the application once then, yes, yo...

Migrate from Delphi 2007 to Delphi 2010
Hi All, Thanks in advance for your help. Below is my query, Currently I am using Delphi 2007 and i want to migrate to Delphi 2010. 1. What all things i need to take care while doing this? 2. What all third party components will get impacted? 3. Any known issues in Delphi 2010 which might impact the cause? 4. Any changes in database operation required as i am using Oracle? Hope I have post this query under correct category. If not sorry for the trouble and could you please suggest me the correct category for this? Looking forward for your response. Have a great day. Th...

Upgrading to Delphi 2009 from Delphi 5
I've decided it's time to upgrade to Delphi 2009 Professional from my current Delphi 5 Professional which (according to the FAQ) makes me eligible for the upgrade pricing. However, I'd just like to clarify how this process works. My concern is that my Delphi 5 is not registered on the CodeGear site and this doesn't seem to be possible as far as I can tell. When installing the trial I noticed that Delphi 2009 registers itself with your CodeGear account so does this mean that the previous version must be registered there to verify you own a Professional edition? I plan to o...

Web resources about - Memory usage in Delphi 2007 vs. Delphi 5 - embarcadero.delphi.non-tech

Memory - Wikipedia, the free encyclopedia
In psychology , memory is the process in which information is encoded, stored, and retrieved. Encoding allows information from the outside world ...

Read-Only Memory
Read-Only Memory publishes high-quality books and articles that document defining moments in videogame history.

Family of Damien Little toast memory of two little boys and their father gone too soon - AdelaideNow ...
A MEMORIAL to a Port Lincoln father and his two young sons has been moved from the water’s edge after the family expressed safety concerns.

SanDisk’s new wireless memory stick will eradicate smartphone storage problems
... devices. And then there are battery life problems. SanDisk has a new product that aims to fix one of them, and that’s the shortage of memory. ...

Holidays a distant memory for traders reeling amid 2016 rout
From Sydney to Dubai, holidays are a distant memory for traders reeling amid the flight from risky assets that has defined the first days of ...

Seven weather presenter David Brown delivers forecast from memory after glitch
Channel Seven's David Brown certainly knows his weather.

Marvell Implements Host Memory Buffer for DRAM-less 88NV1140 SSD Controller
The first version of the Non-Volatile Memory Express (NVMe) standard was ratified almost five years ago, but its development didn't stop there. ...

Violent Femmes share "Memory" from first LP in 15 years
... who turn 35 this year, have just shared the first single from the band's new album We Can Do Anything, the band's first in 15 years. "Memory" ...

Spotify is flying the company flag at half mast in memory of David Bowie
Spotify's office in San Francisco is flying its flag at half mast this week in memory of David Bowie. Bowie died after an 18-month battle with ...

Partners of the Late Sasha Petraske Open Bar in His Memory
... before his death. A few months after the passing of cocktail visionary Sasha Petraske , his partners are opening a bar this week in his memory. ...

Resources last updated: 1/17/2016 10:59:48 PM