FastMM4 for extended stored procedures DLLs under SQL Server



Hello!



My company developed a huge project. Problems with memory usage pushed us
toward memory manager replacement. We chose FastMM478. According to rules
described in FastMM4_Readme.txt file from the downloaded folder I replaced
the default Borland memory manager.



For all the client side of our application and also for all the server side
we do not experience no problems after replacement.

But we have another part of the project which is a set DLLs which implement
extended stored procedures for MSSQL Server. Any of these DLLs has "uses"
clause like this :

library MSSQLFunc;



uses

FastMM4 in 'FastMM4.pas',

SysUtils,

Classes,

Windows,

Variants :





For these DLLs I switched on these FastMM options:
{$define AssumeMultiThreaded}

{$define NeverUninstall}

{$define NoMessageBoxes}



When using the DLLs now we experience a crash - SQL Server process crashes,
not right in the beginning but after a while. And because of the fixed
moment of crash I began to experiment what conditions could I use to avoid
the crash. I began choosing different FastMM options switching ON and OFF.
Finally when I compiled with "{$define FullDebugMode}" everything was good
and no crash was observed.

Unfortunately this is unsuitable because of the heaviness of the
FullDebugMode. We expect a speed impact in that case.



Something more. See where the crash is:

function ConceptTools_UpStr(s:string):string;

var

q:string;

i:integer;

begin

q:='';

if length(s) > 0 then

for I := 1 to length(s) do

q:=q+UpCase(s[i]); ?--- when the "i" has a value of 4, code
crashes here



ConceptTools_UpStr := q;

end;





Two reasons make me think the problems is in FastMM4:

1.. The exception is on such a place that is so close to mere memory
operations. Inside Borland procedure "UpCase" you can see a lot of assembler
code. No ours instance of object is involved.
2.. Good behavior when "{$define FullDebugMode}"




Please someone has any proposals what can be done?

I am ready to send all the Delphi code of all the DLLs.



Thank you!


.



Relevant Pages

  • Re: Memory Management
    ... The program is a bunch of DLLs. ... I'm still using the CRT's malloc and free to allocate memory. ... If the application makes a memory allocation request, ... I have implemented a memory manager for some SDK I'm working on (a ...
    (microsoft.public.vc.language)
  • Re: ReportMemoryleaksOnShutdown:=true;
    ... starting with D2006 the venerable "Borland" memory manager was replaced by a stable version of Pierre le Riche's open sourced FastMM memory manager. ... Up until that version of Delphi, you could perform this replacement yourself by adding the open-source FastMM4.pas unit to your .dpr uses-list. ...
    (borland.public.delphi.non-technical)
  • Re: Fastcode - IA32 Extensions
    ... make a guesstimate of how much each optimization is worth compared to the ... I have my sights set on the memory manager next. ... replacement memory manager on his site, so I'll probably use that as a ... recompile the Borland VCL and RTL source, ...
    (borland.public.delphi.language.basm)
  • Re: Reinstall finished... going to apply the "barbarian" updates ... three questions
    ... > necessary to use FastMem memory manager anymore. ... The FastMM unoffical fix is not necessary any more. ... confused with the memory manager which still makes a good replacement and ...
    (borland.public.delphi.non-technical)
  • Re: quick question
    ... > dlls and the main program, ... application and all the libraries. ... Look in the FAQ for tips on how to share the FastMM memory manager between ...
    (borland.public.delphi.language.basm)