fastmm

How to track down tricky memory leak with fastMM?

After upgrading a project from Delphi 2007 to Delphi 2009 I'm getting an Unknown memory leak, so far I've been tryin to track it down using fastMM, here is what fastMM stack trace reports: A memory block has been leaked. The size is: 20 This block was allocated by thread 0x111C, and the stack trace (return addresses) at the time was...

FreeMM vs ShareMem

Hi, We have a lot of dll-libraries written in both delphi and c++ builder, and use sharemem and borlndmm.dll. An aligment-issue in a 3thparty library forces us over to the new memorymanager in delphi 2007. Can someone please explain 'shared memory manager' for me? Is SimpleShareMem a dropin replacement for ShareMem ? Can we then stop ...

Why the Excess Memory for Strings in Delphi?

I'm reading in a large text file with 1.4 million lines that is 24 MB in size (average 17 characters a line). I'm using Delphi 2009 and the file is ANSI but gets converted to Unicode upon reading, so fairly you can say the text once converted is 48 MB in size. ( Edit: I found a much simpler example ... ) I'm loading this text into a s...

How to get the Memory Used by a Delphi Program.

I know how to get the System memory use using GlobalMemoryStatusEx, but that tells me the what the entire OS is using. I really want my program to report how much memory it alone has allocated and is using. Is there any way within my Delphi 2009 program to call either a Windows function or maybe some FastMM function to find out the me...

How can I use FastMM4 memory leak reporting in a Service?

Does the same technique which FastMM4 for Delphi provides to report memory leaks to a detailed file work if the application runs as service? Of course the best practice would be to write unit tests and a simple standalone application first, and find the leaks there, outside the service environment. Edit: and there is http://blog.delphi-...

How list all instantiated objects?

How can I list all instantiated objects in all application, using FASTMM4 or default memory manager? ...

FastMM4 says "The block header has been corrupted"

Hi. I had this nasty bug that disappeared in the past but now after quite some time it returned. I have two TSam objects (derived from TPersistent) created and loaded into an TAsmJob object (derived from TObjectList). At runtime, a form creates a TStringGrid and then the AsmJob which creates those two SAM objects (and load some data fr...

How to get a stack trace from FastMM

I've noticed in this post that you can get stack trace out of FastMM to show what appears to be where the object was allocated. http://stackoverflow.com/questions/271850/how-to-track-down-tricky-memory-leak-with-fastmm I can't find any information on how to enable this in Delphi 2009. I have set ReportMemoryLeaksOnShutdown to true so ...

Delphi - structures' strings not being freed [FastMM manager]

If I declare PSomeStruct = ^TSomeStruct; TSomeStruct = record s1 : string; end; and I run the following code: var p: PSomeStruct; begin new(p); p^.s1:= 'something bla bla bla'; dispose(p); the FastMM 4 memory manager reports that there was a memory leak (type: string, data dump: "something bla bla bla"). However, if I ...

delphi - terminate all the threads (TThread) on closing application

My application is a tcp/ip server, with main thread created only once & listening all the time. When new client connects, the main thread creates the new thread of TClientThread type. There is however no list of running Client threads, as that would make my app a bit complicated... is there any way to execute "terminate" method on all th...

FastMM svn version

I downloaded FastMM through an svn checkout. (instead of stable packaged version) Can I use it (or is it safe to use) in my release builds? I'm asking this as a seperate question as Rob Kennedy suggested. ...

Delphi: memoryleak in IdStack, but who uses IdStack?

FAstMM reports a memoryleak from a TIdCriticalSection in IdStack.pas. I understand this is a intentional leak, that is documented in the code. What I do not understand, is why IdStack is included in my project. How can I find out what unit pulls it in? Is there a way of excluding this leak from the report, using the version of fastmm t...

Getting a longer stacktrace from FastMM?

When FastMM logs a memory leak it includes a stacktrace going back 9 calls. Problem is that the stacktrace is too general to locate the problem easily. The last function call in the trace is called at least 50 times and the object leaked is a very common one. What can I do to make the stacktrace longer? Tips to locate leaks more easily...

How to correctly free/finalize an ActiveX DLL in Delphi?

We are using a class called ODNCServer here - at initialization, an TAutoObjectFactory object is created: initialization pAutoObjectFactory := TAutoObjectFactory.Create(ComServer, TODNCServer, Class_ODNCServer, ciSingleInstance, tmApartment); Now FastMM is complaining about a memory leak because this object isn't freed anywhere. If ...

FastMM, stack trace memory for leaks in dynamicly loaded DLL, compiled with runtime packages.

Hi, I'm using FastMM together with JCL Debug info to trace memory leaks in my application. However I have plugins which are dlls compiled in Delphi, both dlls and main application use common runtime packages. Now, when I'm shutting down the application, it generates memory leaks report in text file which is fine, but it contains stack tr...

Detect meamleaks with FastMM and the exitcode

I have an idea to enable FastMMs memleakreporting in the nightly automatic build. The messagebox should of course be disabled. The simplest would probably be if the applications exitcode was > 0 if there was a memleak. I did a quick test and the exitcode was 0 with a memleak and FastMM. So my question is how can I detect if there was a...

C++ Builder 2010 How to switch to FASTMM

Hello I have some projects which were done in c++ builder 2009 and they need borlandmm.dll to run. I have read that c++ Builder 2010 by default use Fastmm, but it dont seems to be the case in my projects. They still need borlandmm.dll So how can i switch my projects to use fastmm ? Regards James ...

Why "menus" unit is finalized too early?

I tested my application with FastMM and FullDebugMode turned on, since I had some shutdown problems. After solving bunch of my own problems FastMM started to complain about calling virtual method on a freed object in TPopupList. I tried to move the menus unit as early as possible in uses so that it would be finalized last, but it didn'...

FastMM log to file without FullDebugMode

I'd like to get FastMM memory leak report that shows up on app shutdown, but in a file instead of the dialog box. The idea is to use it in a release build as I have trouble reproducing the leaks. I would however prefer to not use the FullDebugMode which seems to be required for logging to a file. Am I missing anything or is this not sup...

Why does my Delphi program's memory continue to grow?

I am using Delphi 2009 which has the FastMM4 memory manager built into it. My program reads in and processes a large dataset. All memory is freed correctly whenever I clear the dataset or exit the program. It has no memory leaks at all. Using the CurrentMemoryUsage routine given in spenwarr's answer to: http://stackoverflow.com/questi...