🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.deployment
Article #293

Re: Memory corruption and crash - across DLLs

#293
From: Remy Lebeau (TeamB)
Date: Tue, 12 Nov 2002 08:30
30 lines
2544 bytes
"rinu chacko" <rinu@smartedge.net> wrote in message
news:3dd0b4b5@newsgroups.borland.com...

Please don't cross-post, it is against Borland's newsgroup guidelines.  Only
post questions to the single most appropriate group, which in this case
would be the .language.cpp group.

> Now the application crashes during disposing of some
> dynamically allocated memory, which is declared in
> DLL1, allocated in DLL2 and being disposed from
> DLL1.

You shouldn't be allocating the memory in one place and freeing it
elsewhereacross different modules.  You should free the memory from the same
module that is was allocated from.  This insures that the memory manager
that allocated the memory is the same one that frees it correctly.

> - We create TStLlist (systools list object - turbopower library) object in
> DLL1, and pass it to DLL2.
> - Within DLL2, the list getting filled.
> - Back in DLL1, we clear the list. During this it crashes.

How exactly does DLL2 fill the list?  Is it allocating any of its own
dynamic memory for the items?  If so, you should be using DLL2 to free them,
not DLL1.  DLL1 allocated the memory for the list itself, not the items.  It
should only free the list itself, after DLL2 has had a chance to free the
items it allocated.


Gambit
Technical Details
Message-ID: <3dd0bae3@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!newspump.sol.net!mango.news.easynet.net!easynet.net!easynews.net!newsfeed3.easynews.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3dd0b4b5@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10fbec,f3c7411cb82d4ba5,start
X-Google-Attributes: gid10fbec,public
X-Google-Thread: fde74,f3c7411cb82d4ba5,start
X-Google-Attributes: gidfde74,public
X-Google-Thread: f8e54,f3c7411cb82d4ba5,start
X-Google-Attributes: gidf8e54,public
X-Google-ArrivalTime: 2002-11-12 00:50:06 PST
From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com>
Newsgroups: borland.public.cppbuilder.deployment,borland.public.cppbuilder.ide,borland.public.cppbuilder.language.cpp
References: <3dd0b4b5@newsgroups.borland.com>
Subject: Re: Memory corruption and crash - across DLLs
Date: Tue, 12 Nov 2002 00:30:16 -0800
Lines: 32
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 207.175.226.26
Message-ID: <3dd0bae3@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1037089507 207.175.226.26 (12 Nov 2002 00:25:07 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!newspump.sol.net!mango.news.easynet.net!easynet.net!easynews.net!newsfeed3.easynews.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail