🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.delphi.language.basm
8 messages
8 total messages Started by Ian Boyd Fri, 30 May 2008 13:29
Compile FastMM_FullDebugMode.dll into my application?
#462
Author: Ian Boyd
Date: Fri, 30 May 2008 13:29
23 lines
1853 bytes
FastMM is nice, and i like the extra validation it has in FullDebugMode. But 
the dependency on an external dll is a pain, bother and a danger.

Two applications have gone live with FullDebugMode defined. In one case an 
automated agent failed for two months before anyone noticed; costing the 
customer a good amount of money.

Some of you i'm sure would respond, "Well it's your own fault for being 
careless. It's not FastMM's fault."  True enough.


But the solution i would like is to shoot myself in my own foot - and i'm 
looking for the gun.  i want to have the option of compiling the 
FullDebugMode.dll code into my application - so there isn't a dependancy on 
an external dll. i want my application to run slower, be 100kB larger, and 
crash randomly when problems are detected.


Is there any way to do this?


We're using FastMM to replace MemCheck, which was a simple memory leak 
checker that compiled fully into the executable. 
Re: Compile FastMM_FullDebugMode.dll into my application?
#463
Author: Pieter Zijlstra
Date: Sat, 31 May 2008 01:42
45 lines
2295 bytes
Ian Boyd wrote:

> FastMM is nice, and i like the extra validation it has in
> FullDebugMode. But the dependency on an external dll is a pain,
> bother and a danger.
> 
> Two applications have gone live with FullDebugMode defined. In one
> case an automated agent failed for two months before anyone noticed;
> costing the customer a good amount of money.

Ouch!
 
> Some of you i'm sure would respond, "Well it's your own fault for
> being careless. It's not FastMM's fault."  

Yup :)

> True enough.

OK, that's settled ;-)
 
> I want my application to run slower, be 100kB larger, and crash 
> randomly when problems are detected. Is there any way to do this?

In case you haven't, try VB ;-)


> But the solution i would like is to shoot myself in my own foot - and
> i'm looking for the gun.  I want to have the option of compiling the
> FullDebugMode.dll code into my application - so there isn't a
> dependancy on an external dll.

> We're using FastMM to replace MemCheck, which was a simple memory
> leak checker that compiled fully into the executable.

Option uno:
Not what you're looking for but it will prevent you're app from
crashing unnoticed is using the LoadDebugDLLDynamically define.

Another option would be, when not using the "sharedmem" option, to
include the code from the FastMM_FullDebugMode.dpr file, by using
another {$ifdef} in your own copy of the FastMM4.pas file.

-- 
Pieter
Re: Compile FastMM_FullDebugMode.dll into my application?
#464
Author: Craig Peterson
Date: Mon, 02 Jun 2008 19:15
14 lines
1511 bytes
Hi Ian,

 > i want to have the option of compiling the
> FullDebugMode.dll code into my application - so there isn't a dependancy on 
> an external dll.

FastMM doesn't support this.  By being in a DLL the full debug code has 
its own copy of the memory manager that isn't affected by whatever 
caused the fault to trigger in the first place.  Older versions did have 
the debug code compiled in, and the debug code's allocations would hit 
the same error that triggered it in the first place, causing an endless 
loop and eventual stack overflow.

Craig
Re: Compile FastMM_FullDebugMode.dll into my application?
#467
Author: Ian Boyd
Date: Tue, 03 Jun 2008 20:39
11 lines
1483 bytes
> Not what you're looking for but it will prevent you're app from
> crashing unnoticed is using the LoadDebugDLLDynamically define.

i found that define. But someone took the time to include a warning about 
using that option:

    " Note that this may cause problems due to a changed DLL unload
    order when sharing the memory manager. Use with care."

So i didn't want to blindly turn it on when it can somehow cause unspecified 
problems.
Re: Compile FastMM_FullDebugMode.dll into my application?
#466
Author: Ian Boyd
Date: Tue, 03 Jun 2008 20:41
12 lines
1654 bytes
> FastMM doesn't support this.  By being in a DLL the full debug code has 
> its own copy of the memory manager that isn't affected by whatever caused 
> the fault to trigger in the first place.  Older versions did have the 
> debug code compiled in, and the debug code's allocations would hit the 
> same error that triggered it in the first place, causing an endless loop 
> and eventual stack overflow.

This wasn't all the time, right? Only special circumstances would mean that
allocations would fail?

My trying to double free a pointer, and FastMM catching it, wouldn't make
FastMM fail on everthing after that, right?
Re: Compile FastMM_FullDebugMode.dll into my application?
#465
Author: Pieter Zijlstra
Date: Tue, 03 Jun 2008 20:47
20 lines
1652 bytes
Ian Boyd wrote:

> > Not what you're looking for but it will prevent you're app from
> > crashing unnoticed is using the LoadDebugDLLDynamically define.
> 
> i found that define. But someone took the time to include a warning
> about using that option:
> 
>    " Note that this may cause problems due to a changed DLL unload
>    order when sharing the memory manager. Use with care."
> 
> So i didn't want to blindly turn it on when it can somehow cause
> unspecified problems.

Are you sharing the memory manager? That means you're already using
external DLLs and/or packages? If so, then what is the problem adding
one more file to your installation?

-- 
Pieter
Re: Compile FastMM_FullDebugMode.dll into my application?
#468
Author: Craig Peterson
Date: Tue, 03 Jun 2008 21:21
11 lines
1593 bytes
> This wasn't all the time, right? Only special circumstances would mean that
> allocations would fail?

The bug that made Pierre move the code into a DLL was rare, but it was 
triggered by the contents of the stack, so you could hit it even if your 
code was perfect.

> My trying to double free a pointer, and FastMM catching it, wouldn't make
> FastMM fail on everthing after that, right?

FastMM will(should) just fail that one allocation and continue working.
Re: Compile FastMM_FullDebugMode.dll into my application?
#469
Author: Dan Downs
Date: Wed, 04 Jun 2008 04:12
12 lines
1426 bytes
Craig Peterson wrote:
>> This wasn't all the time, right? Only special circumstances would mean 
>> that
>> allocations would fail?
> 
> The bug that made Pierre move the code into a DLL was rare, but it was 
> triggered by the contents of the stack, so you could hit it even if your 
> code was perfect.

I bet that was fun to track down. <eg>

DD
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads