Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

D2006's MM BUG or D2006's BUG?

9 views
Skip to first unread message

shenloqi

unread,
Dec 30, 2005, 10:07:57 PM12/30/05
to
Step to reproduce:

1. Create a new project group
2. Create a new package (Named 'Package1.bpl'; Output Directory is '.\')
3. Create a new console application (or VCL Form application)
4. Set application project's option: Check build with package option, and
add 'Project1' in build with packages
5. In application project's dpr file:
uses SysUtils;
...
ReportMemoryLeaksOnShutdown := True;
UnloadPackage(LoadPackage('Package1.bpl'));
6. Build all project group.
7. Run application.

You will recive a messagebox as below:
---------------------------
Unexpected Memory Leak
---------------------------
An unexpected memory leak has occurred. The unexpected small block leaks
are:

1 - 12 bytes: Unknown x 1
1645 - 1804 bytes: Unknown x 1
---------------------------
OK
---------------------------

I test fastmm4 with Delphi 7 (Regardless package project uses with fastmm4),
No memory leak reported.
If package relationship is more complex, the memory leak is reported more.


Pierre le Riche

unread,
Jan 3, 2006, 10:31:02 AM1/3/06
to
Hi,

> An unexpected memory leak has occurred. The unexpected small block leaks

If you add a package to the "build with packages" option, then that package
is statically linked to your application. You should not use LoadPackage on
such a package. I haven't traced through all the code, but it is clear that
things start going wrong when you call UnloadPackage on the package. If you
take out the package from the "build with packages" option, then things work
fine.

My suggestion is to either add a package to the "build with packages"
option, or to use LoadPackage/UnloadPackage - not both.

Regards,
Pierre


shenloqi

unread,
Jan 3, 2006, 9:32:49 PM1/3/06
to
Hi, Pierre le Riche:

Thank for your reply, I think you are right, and I think this is delphi
2006's defect because I tested it's ok in Delphi 7.

The updated reproducible steps are as below:


1. Create a new project group
2. Create a new package (Named 'Package1.bpl'; Output Directory is '.\')

3. Create another new package (Named 'Package2.bpl'; Output Directory is
'.\')
4. Create a new console application (or VCL Form application)
5. Set application project's option: Check build with package option, and

add 'Project1' in build with packages

6. In application project's dpr file:


uses SysUtils;
...
ReportMemoryLeaksOnShutdown := True;

{!!!!!!!!!!!!!!!!!!!!!!!
Next line just load PACKAGE2.BPL, and even if Package2.bpl never used
package1.bpl, the memory leak is also reported.
If the next line is UnloadPackage(LoadPackage('dbrtl70.bpl')) then no memory
leak report, BUT if the next line is
UnloadPackage(LoadPackage('dbrtl100.bpl')) the memory leak is reported
again.
I found everything is ok if load and unload a bpl build with delphi 7, but
memory leak occurred if load and unload a bpl build with delphi 2006!
!!!!!!!!!!!!!!!!!!!!!!!}
UnloadPackage(LoadPackage('Package2.bpl'));
7. Build all project group.
8. Run application.

You will recive a messagebox as below:
---------------------------
Unexpected Memory Leak
---------------------------

An unexpected memory leak has occurred. The unexpected small block leaks

are:

1 - 12 bytes: Unknown x 1
1645 - 1804 bytes: Unknown x 1
---------------------------
OK
---------------------------


BTW:
Sometimes We need use both the "build with packages" option and
"LoadPackage/UnloadPackage". Suppose that:
1. Define a common interface package include some common interfaces and
global variables.
2. To use these stuffs, I need use the "build with packages" option to
create a executable loader file.
3. In order to inject these global variables defined in common interface
package, I created a new package, implement these global variables in this
package's initialization part.
4. The loader uses "LoadPackage/UnloadPackage" to load the implement
package.


"Pierre le Riche" <pler...@hotmail.com> wrote in message
news:43ba...@newsgroups.borland.com...

Pierre le Riche

unread,
Jan 4, 2006, 2:06:19 AM1/4/06
to
Hi,

> Thank for your reply, I think you are right, and I think this is delphi
> 2006's defect because I tested it's ok in Delphi 7.

I see what you mean... definitely looks like a bug. Will you please log it
to QC?

Thanks,
Pierre


shenloqi

unread,
Jan 4, 2006, 10:14:55 PM1/4/06
to
Sorry, My company do not permit developer register on Borland, So I can not
log in QC, so sadly. Would you like put it in QC? Thanks.

And I found another bug, Would you please log it on QC? Thanks a lot.
Step to reproduce:

1.Clear all files in "Borland Studio Projects" directory.
2.New file named "Project1.dpr".
3.Open BDS 2006.
4.New VCL Forms application.
5.Let BDS 2006 lose the focus.(such as click windows start menu)
6.Let BDS 2006 get the focus.
7.An information dialog is shown:
---------------------------
Information
---------------------------
Module D:\My Documents\Borland Studio Projects\Project1.bdsproj's time/date
on disk has changed. In-memory changes to this module have been detected as
well. Reloading the module from disk will overwrite these changes. Reload?
---------------------------
Yes No
---------------------------
8.Click Yes.An error dialog is shown:
---------------------------
Error
---------------------------
The system cannot locate the object specified.

Line: 0

---------------------------
OK Details <<
---------------------------

Details:
+ $13[523C649A]{xmlrtl100.bpl} XMLDoc.XMLDoc.TXMLDocument.LoadData (Line
2411, "XMLDoc.pas" + 52) + $13
+ $7[523C60AC]{xmlrtl100.bpl} XMLDoc.XMLDoc.TXMLDocument.SetActive (Line
2335, "XMLDoc.pas" + 13) + $7
+ $6[523C5CBC]{xmlrtl100.bpl} XMLDoc.XMLDoc.TXMLDocument.AfterConstruction
(Line 2225, "XMLDoc.pas" + 11) + $6
+ $6[523C5B44]{xmlrtl100.bpl} XMLDoc.XMLDoc.TXMLDocument.Create (Line 2195,
"XMLDoc.pas" + 3) + $6
+ $2[21BAA98B]{delphicoreide100.bpl}
BaseDelphiProject.BaseDelphiProject.TBaseDelphiProject.ReloadFile (Line 828,
"BaseDelphiProject.pas" + 4) + $2
+ $4[20C37FE8]{coreide100.bpl} DocModul.DocModul.CheckFileDates (Line 2383,
"DocModul.pas" + 13) + $4
[0041141F]{bds.exe }
+ $1D[520588F7]{vcl100.bpl } Forms.Forms.TApplication.WndProc (Line 7364,
"Forms.pas" + 119) + $1D
+ $0[51F40BB0]{rtl100.bpl } Classes.Classes.StdWndProc (Line 11572,
"classes.pas" + 8) + $0
+ $6A[77D48731]{USER32.dll } GetDC + $6A
+ $14A[77D48811]{USER32.dll } GetDC + $14A
+ $122[77D489C8]{USER32.dll } GetWindowLongW + $122
+ $A[77D496C2]{USER32.dll } DispatchMessageA + $A

"Pierre le Riche" <pler...@hotmail.com> wrote in message

news:43bb...@newsgroups.borland.com...

Leonel

unread,
Jan 4, 2006, 9:18:18 PM1/4/06
to
shenloqi wrote:

> Sorry, My company do not permit developer register on Borland

What do you mean? BDN registration is free, and does not require serial
numbers or anything else.

> And I found another bug

I logged this one a couple days ago, following up a newsgroup post (was
it from you?).

--
Leonel

shenloqi

unread,
Jan 5, 2006, 3:04:34 AM1/5/06
to
Hi,

> What do you mean? BDN registration is free, and does not require serial
> numbers or anything else.

When I try to log in QC, the error occurred.
An error occurred in the application:

The exception type is:
InvalidCastException

The message that came along with the exception is:
Object cannot be cast from DBNull to other types.

You were attempting to access this link:

http://qc.borland.com/wc/qcmain.aspx

You probably can use your "Back" button to return to where you were before
the error occurred, or simply return to Home Page.


John Kaster (Borland)

unread,
Jan 5, 2006, 2:11:18 AM1/5/06
to
shenloqi wrote:

> When I try to log in QC, the error occurred.

Stay tuned to the borland.public.bdn.qualitycentral newsgroup, where we
will post an announcement when this bug has been fixed. Sorry for the
difficulties.

--
John Kaster http://blogs.borland.com/johnk
Features and bugs: http://qc.borland.com
Get source: http://cc.borland.com
If it's not here, it's not happening: http://ec.borland.com

Leonel

unread,
Jan 5, 2006, 2:10:36 AM1/5/06
to
shenloqi wrote:

> Object cannot be cast from DBNull to other types.

Sorry, some people have been getting this. I'm not sure why. It's
getting investigated.

--
Leonel

shenloqi

unread,
Jan 5, 2006, 4:23:26 AM1/5/06
to
Would you please log this bug to QC? Thanks :-)

"Leonel" <togniolli.@.gmail.com> wrote in message
news:43bc...@newsgroups.borland.com...

shenloqi

unread,
Jan 5, 2006, 4:27:17 AM1/5/06
to
Thanks, I subscribed the newsgroup.

"John Kaster (Borland)" <jo...@borland.com> wrote in message
news:43bcd4a6$1...@newsgroups.borland.com...

John Kaster (Borland)

unread,
Jan 5, 2006, 5:39:52 PM1/5/06
to
shenloqi wrote:

> Would you please log this bug to QC? Thanks :-)

Funny, but as Leonel indicated, we're already working on it.

0 new messages