BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Is MM C++Builder 6 friendly?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Language BASM
View previous topic :: View next topic  
Author Message
Bcc32
Guest





PostPosted: Sat May 14, 2005 2:40 pm    Post subject: Is MM C++Builder 6 friendly? Reply with quote



Hello all

First I would like to say... Nice work!
I have tested memory manager replacements [Intel PIII 533 WinXP Home
C++Builder 6 with sp4]
by adding units to one of my projects, one memory manager per build, as
first unit in project manager.

Sources from borland.public.attachments
Subject: Fastcode MM B&V 0.36
Date: Sun, 8 May 2005 22:17:35 +0200
Message-ID: <427e74bf (AT) newsgroups (DOT) borland.com>
Xref: newsgroups.borland.com borland.public.attachments:8908

I am not benching results, just evaluating application performance with
enhanced memory managers.
TopMemory seemed to perform best in my application as is

Topmemory, HPMM, Qmemory, EWCMM open run no errors
Bucketmem, MultiMM, RecyclerMM, Access Violation on close
FastMM, FastMM3, PSDMemoryManager runtime error 204 on run
HeapMM EListError on close
WinMM runtime error 227 on run



Is there anything I should do or could do to fix AVs and runtime errors?
Do I need to change project options?

All compile and link...
I would especially like to make BucketMem C6 compatible because my
procedures completed
fastest with it. I dont know how to stop AVs on closing my application.
Does anyone have any advice or comments about this?

Thanks
Bcc32




Back to top
Avatar Zondertau
Guest





PostPosted: Sat May 14, 2005 5:58 pm    Post subject: Re: Is MM C++Builder 6 friendly? Reply with quote



Quote:
Is there anything I should do or could do to fix AVs and runtime
errors? Do I need to change project options?

All compile and link...
I would especially like to make BucketMem C6 compatible because my
procedures completed
fastest with it. I dont know how to stop AVs on closing my
application. Does anyone have any advice or comments about this?

I suggest you make a backup of your project and then remove as much of
it as you can, without removing the error. Try to make an example as
simple as possible that reproduces the error, preferably everytime.

If you post this example this might either be very helpful to the
FastCode MM project (if the bug is in the memory managers) or it might
help us solve your problem (if the bug is in your code).

Back to top
Pierre le Riche
Guest





PostPosted: Sat May 14, 2005 7:22 pm    Post subject: Re: Is MM C++Builder 6 friendly? Reply with quote



Hi,

Quote:
Bucketmem, MultiMM, RecyclerMM, Access Violation on close
FastMM, FastMM3, PSDMemoryManager runtime error 204 on run
HeapMM EListError on close
WinMM runtime error 227 on run

Stupid question: Did you remember to make the replacement memory manager the
very first unit that is initialized when your projects starts up?

Regards,
Pierre



Back to top
Avatar Zondertau
Guest





PostPosted: Sat May 14, 2005 8:04 pm    Post subject: Re: Is MM C++Builder 6 friendly? (Reply from Bcc32 by e-mail Reply with quote

Replied to me by e-mail from Bcc32:

Quote:
I suggest you make a backup of your project and then remove as much of
it as you can, without removing the error. Try to make an example as
simple as possible that reproduces the error, preferably everytime.

If you post this example this might either be very helpful to the
FastCode MM project (if the bug is in the memory managers) or it might
help us solve your problem (if the bug is in your code).

Hi Avatar,
I tried creating a new project rather than cutting out code...
Then I used the project manager to rightclick project1.exe->add...
BucketMem.pas
I dragged BucketMem.Pas to the top so it compiles first (just below
project1.exe in projmanager)

add/remove packages uncheck all but Borland Standard Components
build with runtime packages=unchecked

In project source...
<PROJECT value="Project1.exe"/>
<OBJFILES value="..PastestBucketMem_ASM.obj Project1.obj
Unit1.obj"/>
...
<LIBRARIES value="rtl.lib vcl.lib"/>
<SPARELIBS value="rtl.lib vcl.lib"/>
<PACKAGES value="vcl.bpi rtl.bpi vclx.bpi"/>

I click run... and see a blank form
When I close it by clicking x...I see dialog

---------------------------
Debugger Exception Notification
---------------------------
Project Project1.exe raised exception class EAccessViolation with
message
'Access violation at address 0045539A. Read of address 00C05C9C'.
Process
stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------

I view cpu window from Exception Notification Dialog
It is stopped on line that reads

004550E4 jz +0x17
004550E6 mov ebx,[eax+0x0c] <-stops here
004550E9 test eax,eax
004550EB jz +0x0a

mov ebx,[eax+0x0c] is also where it stops in my app.

Sorry for the clutter but I am trying to be cl
Is there anything else I should try?

Bcc32

Back to top
Bcc32
Guest





PostPosted: Sat May 14, 2005 8:15 pm    Post subject: Re: Is MM C++Builder 6 friendly? Reply with quote

Hi Pierre

I am not certain I am doing this correctly, but I am using project manager
to drag unit to top
just below project.exe
this results in these line in project source...
<PROJECT value="Project1.exe"/>
<OBJFILES value="..PastestBucketMem_ASM.obj Project1.obj Unit1.obj"/>
should I try using #include BucketMem.hpp in a specific location?

Thanks for helping
Bcc32


*sorry meant to reply to newsgroup :P

Quote:
Did you remember to make the replacement memory manager the very first unit
that is initialized when your projects starts up?

Regards,
Pierre





Back to top
Pierre le Riche
Guest





PostPosted: Sat May 14, 2005 8:27 pm    Post subject: Re: Is MM C++Builder 6 friendly? Reply with quote

Hi,

Quote:
I am not certain I am doing this correctly, but I am using project manager

The easiest way to find out if it is the first unit that is being
initialized is to trace into your program (F7 in Delphi, probably the same
in BCB) and check that the initialization section of the replacement MM is
the very first initialization section of all the units you use.

The symptoms you describe is typical of another unit being initialized
before the replacement MM and allocating memory using the Borland MM. Some
MMs check whether there is already memory allocated when it starts up
(PSDMM, FastMM, FastMM3) and throws a runtime error right there. Others
don't check for it, but cause a crash when the memory that was allocated by
the Borland MM is attempted to be freed by the replacement MM... this error
typically occurs at program shutdown.

Regards,
Pierre



Back to top
Bcc32
Guest





PostPosted: Sat May 14, 2005 8:52 pm    Post subject: Re: Is MM C++Builder 6 friendly? Reply with quote

Hi Pierre

Thanks for explaining this.
I removed BucketMem.pas

I added #include "BucketMem.hpp" before all else in unit1 header
no more AVs

Thank you!

Bcc32

Quote:
check that the initialization section of the replacement MM is the very
first initialization section of all the units you use.

The symptoms you describe is typical of another unit being initialized
before the replacement MM and allocating memory using the Borland MM.



Back to top
Avatar Zondertau
Guest





PostPosted: Sat May 14, 2005 8:52 pm    Post subject: Re: Is MM C++Builder 6 friendly? (Reply from Bcc32 by e-mail Reply with quote

Quote:
I tried creating a new project rather than cutting out code...
Then I used the project manager to rightclick project1.exe->add...
BucketMem.pas
I dragged BucketMem.Pas to the top so it compiles first (just below
project1.exe in projmanager)

I view cpu window from Exception Notification Dialog
It is stopped on line that reads

004550E4 jz +0x17
004550E6 mov ebx,[eax+0x0c] <-stops here
004550E9 test eax,eax
004550EB jz +0x0a

mov ebx,[eax+0x0c] is also where it stops in my app.

Sorry for the clutter but I am trying to be cl
Is there anything else I should try?

I'm afraid i can't help you further here, because i don't have
C++Builder. If i do something similar using Delphi i don't get any
errors (however if i try to link in BucketMem as an obj file i can't
compile, getting an error message about 16-bit fixups and missing
references).

I guess someone who does use C++Builder should try this and see if they
can find the cause.

Back to top
Bcc32
Guest





PostPosted: Sat May 14, 2005 9:12 pm    Post subject: Re: Is MM C++Builder 6 friendly? Reply with quote

Hi Avatar

I was adding BucketMem.pas to my project,
but this gives me no control over initialization timing.
I was doing this for all MMs
I removed BucketMem.pas and included BucketMem.hpp generated by C++Builder
as the first #include in Unit1.h.
No more Access Violations on Application Close!

Thanks
Bcc32


Back to top
Palle Meinert
Guest





PostPosted: Sat May 14, 2005 9:21 pm    Post subject: Re: Is MM C++Builder 6 friendly? Reply with quote

I ones tested a custom manager and if my memory serves me right you should
add add it to project source (not one of the units), since this is where
your program starts, so you don't mix allocation from the Borland memory
manager with the custom memory manager you want to utilize.

In the menu of BCB choose project -> view source to edit this source.

/Palle



Back to top
Bcc32
Guest





PostPosted: Sat May 14, 2005 10:21 pm    Post subject: Re: Is MM C++Builder 6 friendly? Reply with quote

Hi Palle
mmm...
I will try this now, no AVs but maybe still not quite right...
I see what you mean. Im sure I don't want some hybrid memory management
issues popping up when I am expecting something else...

Thanks for the tip.

Bcc32
Quote:
you should add add it to project source (not one of the units), since this
is where your program starts, so you don't mix allocation from the Borland
memory manager with the custom memory manager you want to utilize.

In the menu of BCB choose project -> view source to edit this source.

/Palle



Back to top
Bcc32
Guest





PostPosted: Sat May 14, 2005 10:56 pm    Post subject: Re: Is MM C++Builder 6 friendly? Reply with quote

Hello all
As a followup to my prior post...
First I commented out #include <BucketMem.hpp> in Unit1.h

I tried adding the line
#include <BucketMem.hpp>
as the first include of my Project1.cpp

this resulted in Borland mm I believe (slow)
so I commented that out.
then I tried adding the line

USEUNIT("BucketMem.pas");

so it now looks like..

//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
//---------------------------------------------------------------------------
USEUNIT("BucketMem.pas");
USEFORM("Unit1.cpp", Form1);
USEFORM("Form3.cpp", Form3);
USEFORM("Form4.cpp", Form4);
USEFORM("Form2.cpp", Form2);
//---------------------------------------------------------------------------
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
<chop>

this has worked great so far

Maybe this is the proper way...

Thanks for the help
Bcc32


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Language BASM All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.