Memory Instance Size

Not sure where this question should really go, so move it if it should go somewhere else.  We have a large multi-threaded D7 ADO SQL Server application and it is slowly eating memory on our larger customers.  We use the latest FastMM and it reports no memory leaks on exit.  I am guessing that a list or similar structure is being appended somewhere in the application and is simply never letting the memory go.  The question is pretty simple.  Is there a way to track by object instance its size across a mult
i-threaded EXE?  I would like to know after our app has been running a few days what instances are consuming the bulk of the memory.  I have tried products like AQTime but they are only giving me haystacks rather than the needle inside of it.  We are at a loss currently.  I am not sure if an app like WinDbg can find what I am looking for either.  Any help would be greatly appreciated.
0
Cameron
10/12/2009 8:58:49 PM
embarcadero.delphi.tools 5366 articles. 3 followers. Follow

9 Replies
655 Views

Similar Articles

[PageSpeed] 0

One suggestion

One of your objects keeps memory (other object instances) around but free them all when application shuts down hence that the reason why memory manager does not report problem on shutdown. You should keep track at run time which one created but only got free when shutdown

> {quote:title=Cameron Cole wrote:}{quote}
> Not sure where this question should really go, so move it if it should go somewhere else.  We have a large multi-threaded D7 ADO SQL Server application and it is slowly eating memory on our larger customers.  We use the latest FastMM and it reports no memory leaks on exit.  I am guessing that a list or similar structure is being appended somewhere in the application and is simply never letting the memory go.  The question is pretty simple.  Is there a way to track by object instance its size across a mu
lti-threaded EXE?  I would like to know after our app has been running a few days what instances are consuming the bulk of the memory.  I have tried products like AQTime but they are only giving me haystacks rather than the needle inside of it.  We are at a loss currently.  I am not sure if an app like WinDbg can find what I am looking for either.  Any help would be greatly appreciated.
0
An
10/12/2009 9:19:46 PM
Cameron,

<< Not sure where this question should really go, so move it if it should go 
somewhere else.  We have a large multi-threaded D7 ADO SQL Server 
application and it is slowly eating memory on our larger customers.  We use 
the latest FastMM and it reports no memory leaks on exit.  I am guessing 
that a list or similar structure is being appended somewhere in the 
application and is simply never letting the memory go.  The question is 
pretty simple.  Is there a way to track by object instance its size across a 
mult
 i-threaded EXE?  I would like to know after our app has been running a few 
days what instances are consuming the bulk of the memory.  I have tried 
products like AQTime but they are only giving me haystacks rather than the 
needle inside of it.  We are at a loss currently.  I am not sure if an app 
like WinDbg can find what I am looking for either.  Any help would be 
greatly appreciated. >>

Do you have the ability to simulate repeated operations that are similar to 
what the application is performing ?  Or are you wanting to track this down 
in the field at the customer that is experiencing the problem ?

To answer your question: yes, it is possible to track this type of 
information and report on it.  It's just a matter of sticking in a 
replacement memory manager in front of FastMM4 that does the tracking.

-- 
Tim Young
Elevate Software
www.elevatesoft.com
1
Elevate
10/12/2009 9:34:33 PM
> You should keep track at run time which one created 
> but only got free when shutdown

Our application is vast and to see the problem with enough size requires running the middle tier for a few days with hundreds of users logged in running thousands of transactions per minute.  The number of objects is dizzying actually.  I can't imagine writing the code to track the 50000 or so objects for our big customers.  

> Do you have the ability to simulate repeated operations that are similar to 
> what the application is performing ?  Or are you wanting to track this down 
> in the field at the customer that is experiencing the problem ?

Not really possible to test this problem in dev or qa given our architecture.  It has to be tracked in production, but I can put a debug version out with pretty much any code that would help solve or identify the problem.
 
> To answer your question: yes, it is possible to track this type of 
> information and report on it.  It's just a matter of sticking in a 
> replacement memory manager in front of FastMM4 that does the tracking.

Any suggestions?  I haven't really found a memory manager that tracks this sort of thing but I only know of 3 or 4.  

Just as an FYI we see the growth in all our customer systems, but it is the really big ones that are troublesome.  Most customers can run a month without any problems and they usually have routine maintenance that resets the application.  On our biggest customers we only get about 200 hours before the problem starts to cause serious performance issues and we have to reset.

Edited by: Cameron Cole on Oct 12, 2009 3:49 PM
0
Cameron
10/12/2009 10:49:20 PM
Cameron,

<< Any suggestions?  I haven't really found a memory manager that tracks 
this sort of thing but I only know of 3 or 4. >>

Send me a private email at timyoung@elevatesoft.com and I'll see what I can 
do for you.

-- 
Tim Young
Elevate Software
www.elevatesoft.com
0
Elevate
10/12/2009 11:11:07 PM
Cameron Cole wrote:

> Not sure where this question should really go, so move it if it
> should go somewhere else.  We have a large multi-threaded D7 ADO SQL
> Server application and it is slowly eating memory on our larger
> customers.  We use the latest FastMM and it reports no memory leaks
> on exit.

Take a look at global variables and see what they allocate, or which
objects they hold. An object in a global variable (or, say,
Application) would probably not be freed shortly before the memory
manager does its counting.

-- 
Rudy Velthuis (TeamB)        http://www.teamb.com

"Smoking is one of the leading causes of statistics."
 -- Fletcher Knebel
0
Rudy
10/13/2009 12:07:34 AM
Tim


If you do come up with something post the solution in the elevate ngs as well please. I for one would be interested.

Roy Lambert
0
Roy
10/13/2009 8:28:22 AM
Roy,

<< If you do come up with something post the solution in the elevate ngs as 
well please. I for one would be interested. >>

Here is my email to Cameron:

I was going to give you a replacement memory manager to do this, and then I
thought that it best to check the FastMM4 code to make sure that they don't
already have something like this in place.  It turns out that they do, in
FastMM4.pas:

{$ifndef FullDebugMode}
{The standard memory manager functions}
function FastGetMem(ASize: Integer): Pointer;
function FastFreeMem(APointer: Pointer): Integer;
function FastReallocMem(APointer: Pointer; ANewSize: Integer): Pointer;
function FastAllocMem(ASize: Cardinal): Pointer;
{$else}
{The FullDebugMode memory manager functions}
function DebugGetMem(ASize: Integer): Pointer;
function DebugFreeMem(APointer: Pointer): Integer;
function DebugReallocMem(APointer: Pointer; ANewSize: Integer): Pointer;
function DebugAllocMem(ASize: Cardinal): Pointer;
{Specify the full path and name for the filename to be used for logging
memory
 errors, etc. If ALogFileName is nil or points to an empty string it will
 revert to the default log file name.}
procedure SetMMLogFileName(ALogFileName: PChar = nil);
{Returns the current "allocation group". Whenever a GetMem request is
serviced
 in FullDebugMode, the current "allocation group" is stored in the block
header.
 This may help with debugging. Note that if a block is subsequently
reallocated
 that it keeps its original "allocation group" and "allocation number" (all
 allocations are also numbered sequentially).}
function GetCurrentAllocationGroup: Cardinal;
{Allocation groups work in a stack like fashion. Group numbers are pushed
onto
 and popped off the stack. Note that the stack size is limited, so every
push
 should have a matching pop.}
procedure PushAllocationGroup(ANewCurrentAllocationGroup: Cardinal);
procedure PopAllocationGroup;
{Logs detail about currently allocated memory blocks for the specified range
of
 allocation groups. if ALastAllocationGroupToLog is less than
 AFirstAllocationGroupToLog or it is zero, then all allocation groups are
 logged. This routine also checks the memory pool for consistency at the
same
 time.}
procedure LogAllocatedBlocksToFile(AFirstAllocationGroupToLog,
ALastAllocationGroupToLog: Cardinal);
{$endif}

What you want to do is this:

1) Make sure that you're using FastMM4
(http://sourceforge.net/projects/fastmm/).

2) Enable the FullDebugMode compiler define in the FastMM4Options.inc file
that comes with FastMM4 (remove the period in front of it).

3) Make sure that the application includes TD32 debug information
(Project/Options/Linker/Include TD32 debug info).

4) Decide whether to use the AllocationGroup functionality or not (see
above).  I would suggest to use it in the areas of the application that you
wish to scrutinize the closest, or that you think have the most chance of
being the area where the memory is being allocated, but not freed until the
application closes.

5) Use the SetMMLogFileName procedure (see above) to specify where to dump
any memory allocation information.

6) Use the LogAllocatedBlocksToFile procedure to dump the current memory
contents to the dump file using a timer that you add in the application.  I
would set it to something like once every 1/2 hour or so.   If you have
multiple threads in the application, then you need to make sure that you
only do this when they aren't running or use critical sections, etc. to make
sure that such threads do not try to perform any memory
allocation/deallocation until this procedure is done.  As far as I can tell
by the source code, this procedure does not lock the appropriate memory
block lists in the memory manager while it executes.

Note:
You'll need to make sure that the FastMM4 unit is in your USES clause of the
unit that calls the SetMMLogFileName and LogAllocatedBlocksToFile
procedures.

7) Make sure to rebuild the application completely.

Also, these log files tend to be very large, so if you have trouble
analyzing them manually, you may need to parse them and load them into a
database for proper slicing and dicing.   If you need help with that, just
let me know.

I think that about covers it, but if you have any other questions, ask away.

Tim Young
Elevate Software
www.elevatesoft.com
1
Elevate
10/13/2009 4:32:55 PM
Tim


Thanks, now get back to your own problem stack <g>

Roy Lambert
0
Roy
10/13/2009 5:51:53 PM
I've used AQTime to solve issues like this. It will give me counts on 
current allocated objects.
0
Ed
10/22/2009 9:25:35 PM
Reply:

Similar Artilces:

Tools, Tools, Tools
</quot> Couple useful things for IT admins out there. I've packaged up Werner and Feder's PoC scanner via py2exe here. You can now simply run: </end_quot> http://www.doxpara.com/ -- "Never drive faster than your ANGEL can fly" ...

memory, memory, memory
Name: bruce Email: bruceatlmcsoftwaredotcom Product: Firefox Summary: memory, memory, memory Comments: Hi, I run firefox all day like I run Outlook. I open/close a zillion tabs using a single instance of firefox, usually no more than 6 tabs at a time. But I've had 20 tabs open at once while I'm culling the NY Times articles I want to print. Every so often my mouse stops moving. Taskmgr shows firefox has 256 Megs of memory (or something equally large) and is using 95% of the cpu. Why?? Make this nonsense stop! Forget the IE/Firefox/Chrome competition. T...

Delphi 2009 Tool palette Icon size and color depth?
Hi, 1) There are three icon size available at Delphi 2009 Tool palette for each component. What is the icon size and color depth for each of them? How should they stored in the *.DCR file? Until now, I used only one Icon per component with 24x24 pixels and 16 colors. 2) Where Delphi 2009 Tool palette original Icons are stored? Thanks, Rafi <Rafi Eron> wrote in message news:36027@forums.codegear.com... > There are three icon size available at Delphi 2009 Tool palette for > each component. What is the icon size and color depth for each > of them? I do not know...

ANN: wxForms for Delphi
We are pleased to announce the release of our wxWidgets Form Designer for Delphi - wxForms for Delphi 1.1. wxForms for Delphi is an integrated form designer plugin for Borland /CodeGear Delphi that helps to create cross platform applications for Windows, Mac OSX and Linux using single source base. The wxForms code from Delphi can be compiled in Mac OSX and Linux without much change using FreePascal. wxForms for Delphi allows you to use all the Delphi's powerful Form Designer/ Editor features (Form Alignment, Object inspector, Component Palette etc ) to quickly create Cross platfor...

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 ...

delphi 2010 memory not released when closing delphi project
each time im runing delphi 2010 the memory that was used was not release after closing a project and the memory don't stop to grow and the browsing for file becoming slow any idea ? Thanks Pierre Auger wrote: > each time im runing delphi 2010 the memory that was used was not > release after closing a project and the memory don't stop to grow and > the browsing for file becoming slow > > any idea ? You are using some 3rd-party components that do not properly release memory in their design-time packages would be my guess. A design-time package stays l...

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...

Memory and More Memory
What's the news on fixing this memory issue with FireFox/Thunderbird. T= he = two biggest memory gulpers I've ever used on any computer-bar none. And= = Why do these Mozilla apps take so long to long. It not worth having the= se = apps as defaults for surfing or email/usenets. How could anyone lauch a= = new internet suite with so much system demand..and through constant = updates, still overlook the memory issues. I'm questioning the integrit= y = of Mozilla these days and Opera 8-9 runs like a scaulded dog. I think I'= ll = stay with O...

Memory size
--____GEUPLLLVTAXBNUHNUYLN____ Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: base64 Content-Disposition: inline; modification-date="Sat, 3 Apr 2009 13:18:32 +0100" SGksDQoNCldoYXQgaXMgdGhlIG1heGltdW0gbWVtb3J5IHNpemUgYW5kIHZvbHVtZSBzaXplIHN1 cHBvcnQgb24gTmV0d2FyZSA2LjUuOD8NCg0KVGhhbmsncw0KVmllZ2Fz --____GEUPLLLVTAXBNUHNUYLN____ Content-Type: multipart/related; boundary="____VPRZSOJMNYDDDSQNSZUP____" --____VPRZSOJMNYDDDSQNSZUP____ Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: base64 Content-Disposition: inline; mod...

How to Add the maximum size of memory to srvIQ to not take all the physical memory ?
Hi All, IQ12.4.3 ++Load Memory MB 350 dbo 127 PUBLIC My srvIQ take more and more memory in the file of time, until being saturated. In this case I am obliged to restart it. How to make to affect a maximum size of memory to srvIQ and do not take all the physical memory? Thanks in advance. Regards, Claude Are u in a Windows box? I guess freeing memory is not that great up till IQ 12.5. Best way is to restart IQ once in 2-3 days.. Else upgrade ot 12.6. Sybase claims memory management is better in 12.6 > Hi All, > IQ12.4.3 > ++Load Memory MB > 350 dbo ...

Tools > Check mailbox size doesn't show mailbox size Mb in Spanish version
In he GW 7.0.2 HP Client, when you open the Check Mailbox Size, in spanish language, it displays the correct % quota, but it not displays the space usage. Does this happens to someone else? Thanks Henry, It appears that in the past few days you have not received a response to your posting. That concerns us, and has triggered this automated reply. Has your problem been resolved? If not, you might try one of the following options: - Visit http://support.novell.com and search the knowledgebase and/or check all the other self support options and support programs availabl...

Max Memory Size
Aloha Everyone, I have a really quick question ;) I have a New Dell R900 server with 16GB of Ram. Our office plans on installing Novell Netware 6.5 sp7 on the system. Is there a memory limitation on using Novell Netware :) If there does exist a memory limitation issue, is there a workaround to utilizing all 16GB of ram :) Thanks, Brian Low IT Specialist State of Hawaii Tax Office -- briandlow ------------------------------------------------------------------------ Hi, briandlow wrote: > > Aloha Everyone, > I have a really quick question ;) I have...

Memory leak tool
Hi, Will you recommend a tool/method to detect memory leak in an application constructed using PB 5.0.3. ---- Regards Anantha Anantha: I highly recommend BoundsChecker from NuMega Technologies. http://www.numega.com/ HTH Scott k.Anantharaman wrote in message <366CBDBD.A68AC80@hclt.com>... >Hi, >Will you recommend a tool/method to detect memory leak in an >application constructed using PB 5.0.3. >---- >Regards >Anantha > Greetings ! BoundsChecker is recommended for VC++,Delphi and VB? Will it be suitable for PB also.? Any experi...

Memory size for Strings?
 Hi all,    How much amount of memory will be allocated for strings for example if i give something like this,      String str = "test for memory size";      As well as for StringBuilders.. ThanksVishawanath  Hi.. Try this article..http://www.yoda.arachsys.com/csharp/strings.htmlCheers PushpIf you find this post useful, mark it as an Answer  String: In the current implementation at least, strings take up 20+(n/2)*4 bytes (rounding the value of n/2 down), where n is the number of character...

Web resources about - Memory Instance Size - embarcadero.delphi.tools

Instance (computer science) - Wikipedia, the free encyclopedia
An instance, in object-oriented programming (OOP) , is a specific realization of any object . An object may be varied in a number of ways. Each ...

Mark Zuckerberg On Oculus VR, WhatsApp Acquisitions: ‘These Are Two Kinds Of Rare Instances’
Facebook Co-Founder and CEO Mark Zuckerberg said during his keynote address at the 2014 GSMA Mobile World Congress in Barcelona, Spain, Feb. ...

Changed the AWS instance size on the Trex server from small to large, and now it runs much better. ;-) ...
... piece. The one that made the big difference came from my longtime programming friend Chuck Shotton. We increased the size of the AWS instance ...

The Instance - Podcast App on the App Store on iTunes
Get The Instance - Podcast App on the App Store. See screenshots and ratings, and read customer reviews.

An instance of the fingerpost - Flickr - Photo Sharing!
Quite literally a fingerpost. Pelsall, Walsall, West Midlands. I had to drive past it to get to a meeting today. Great isn't it?

Buzzfeed Cans Editor After Uncovering '40 Instances' Of Plagiarism
... Editor-In-Chief Ben Smith announced his decision to fire the site’s “viral politics” writer Benny Johnson after finding at least “40 instances” ...

ACORN website allows Canberrans to report growing instances of cybercrime
A new website to fight cybercrime is set to save police an enormous amount of time and money.

Abbott's shift on settlements one more instance of secrecy
At least the Abbott government is doing its bit for the reading skills of journalists within Australia. Since there are fewer news conferences, ...

Little Lunch and Utopia are instances of great TV screenwriting
In terms of quality being measured against quantity, the best new Australian television show this year is Little Lunch.

Queensland Police are investigating several instances of looting in Bundaberg and Gympie
POLICE are investigating several instances of looting in Gympie and Bundaberg in the wake of flooding.

Resources last updated: 12/21/2015 3:05:20 AM