d-mozulyov / brainmm Goto Github PK
View Code? Open in Web Editor NEWExtremely fast memory manager for Delphi
Home Page: http://www.sql.ru/forum/1213139/ekstremalno-bystryy-menedzher-pamyati-brainmm
License: MIT License
Extremely fast memory manager for Delphi
Home Page: http://www.sql.ru/forum/1213139/ekstremalno-bystryy-menedzher-pamyati-brainmm
License: MIT License
When starting a second instance of the same program with BrainMM i get a access violation on the line 10523 (master).
if (BrainMMRegistered.BrainMM.Options.FreePacalCompiler <> {$ifdef FPC}True{$else}False{$endif}) then
begin
BrainMMFreeMemOriginal := MemoryManager.Standard.FreeMem;
MemoryManager.Standard.FreeMem := BrainMMFreeMemInverter;
end;
It seems that MapAddress := MapViewOfFile(BrainMMRegisteredHandle, FILE_MAP_READ, 0, 0, 0);
isn't working as expected (line 10470). The fields of BrainMMRegistered
are all nil.
This bug occurs with Debug Win 32 Delphi 10.2 Toyko.
Hi!
I'm creating a package that merely contains the brainmm.pas unit. When I compile it, next error appears: E2201 need imported data reference ($G) to access 'ReportMemoryLeaksOnShutdown' from unit 'BRainMM'. I have tried with that directive, also with the '{$IMPORTEDDATA ON}' after reading in the web some similar errors, but can't make it compile... :(
If I use the brainmm in a normal proyect (no packages), no problem. But when you use packages in any way, the problem appears and don't know how to solve it
Any idea what is happening?
See some notes and a link at pleriche/FastMM4#21
It's not clear to me under what license you're making the project available.
It reads like the MIT license.
It would help if you make explicit whether it is BSD, MIT, Mozilla etc.
You might also want to dual license it so that more people can use it potentially.
{$ifdef MSWINDOWS}
const
BRAINMM_MARKER: array[1..18] of WideChar = 'Local\BrainMM_PID_';
HEX_CHARS: array[0..15] of WideChar = '0123456789ABCDEF';
Those lines return me a incompatible array's and string error, when I try to compile under Delphi7...
what is the consequence if we use used char instead of Widechar (with char, and OpenFileMapping, CreateFileMapping I can compile it...) ?
Hello,
if you use BrainMM under Win64 Service it will crash the service. (it will not start)
Thank you
Hello,
We are developing a massively parallel application and are hitting the limits of the default Delphi memory allocator in this situation.
As a result, we are investigating replacements for which BrainMM appears to be a very promising candidate.
However, we are hitting an issue where we get InvalidPtr exceptions in the x64 version of our application. We narrowed it down to the following command line application:
program BrainMMTest;
{$APPTYPE CONSOLE}
uses
BrainMM,
System.Diagnostics,
System.TimeSpan,
System.SysUtils,
System.Classes,
System.Generics.Collections,
Winapi.Windows;
{$R *.res}
type
TTestThread = class(TThread)
public
procedure Execute; override;
end;
var
Stopwatch: TStopwatch;
Elapsed: TTimeSpan;
ThreadList: TList<TThread>;
Threads: array of TTestThread;
iGlobal: Integer;
const
C_StrL = 16351;
{ TTestThread }
procedure TTestThread.Execute;
var
CurrentStringList: TStringList;
i: Integer;
CurrentString: string;
begin
CurrentStringList := TStringList.Create;
try
for I := 1 to 1571000 do
begin
SetLength(CurrentString, C_StrL);
SetLength(CurrentString, 0);
CurrentStringList.Add(IntToStr(Random(i)) + 'bob' + IntToStr(Random(i)));
end;
finally
CurrentStringList.Free;
end;
end;
begin
try
Stopwatch := TStopwatch.StartNew;
SetLength(Threads, 40); // highly parallel
ThreadList := TList<TThread>.Create;
try
for iGlobal := Low(Threads) to High(Threads) do
begin
Threads[iGlobal] := TTestThread.Create;
ThreadList.Add(Threads[iGlobal]);
end;
while ThreadList.Count > 0 do
begin
if ThreadList[0].WaitFor = WAIT_OBJECT_0 then
ThreadList.Delete(0);
Sleep(10);
end;
finally
ThreadList.Free;
end;
Elapsed := Stopwatch.Elapsed;
Writeln(Format('BrainMM took %n milliseconds', [Elapsed.TotalMilliseconds]));
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
readln;
end.
In 32bits mode, either debug or release, it works fine and takes about 15s on my computer.
In 64bits mode, either debug or release, it rarely works in which case it takes about 7s. But most often, and even more so when run via the IDE (Delphi Seattle) it crashes almost immediately.
Looking at the call stack, the exception is raised by RaiseInvalidPtr
from ResizeDifficult
itself being called by BrainMMReallocMem
which seems quite logical as the program above does a lot of memory reallocation.
Fiddling with different options, we discovered that defining PUREPASCAL
at the top of the BrainMM unit makes the error disappear, which hints that the issue may be in the x64 version of the assembly code for BrainMMReallocMem
.
However, we were not able to figure out what's wrong in that code, it's a bit too difficult for us to understand, let alone offer a fix.
Any suggestion would be most welcome.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.