Article View: borland.public.cppbuilder.deployment
Article #294Re: Memory corruption and crash - across DLLs
From: rinu chacko
Date: Tue, 12 Nov 2002 09:21
Date: Tue, 12 Nov 2002 09:21
42 lines
2747 bytes
2747 bytes
Sorry guys, I was not very sure of which group to post it to. Thank you for conveying that language.cpp is the right one. "Remy Lebeau (TeamB)" <gambit47@yahoo.com> wrote in message news:3dd0bae3@newsgroups.borland.com... > "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:
<3dd0c7d8@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-04!supernews.com!newsswitch.lcs.mit.edu!snoopy.risq.qc.ca!chi1.webusenet.com!c02.atl3!news.webusenet.com!news02.tsnz.net!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3dd0b4b5@newsgroups.borland.com> <3dd0bae3@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10fbec,f3c7411cb82d4ba5 X-Google-Attributes: gid10fbec,public X-Google-Thread: f8e54,f3c7411cb82d4ba5 X-Google-Attributes: gidf8e54,public X-Google-ArrivalTime: 2002-11-12 01:30:06 PST From: "rinu chacko" <rinu@smartedge.net> Newsgroups: borland.public.cppbuilder.deployment,borland.public.cppbuilder.ide References: <3dd0b4b5@newsgroups.borland.com> <3dd0bae3@newsgroups.borland.com> Subject: Re: Memory corruption and crash - across DLLs Date: Tue, 12 Nov 2002 14:51:11 +0530 Lines: 44 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 NNTP-Posting-Host: 202.54.89.67 Message-ID: <3dd0c7d8@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1037092824 202.54.89.67 (12 Nov 2002 01:20:24 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-04!supernews.com!newsswitch.lcs.mit.edu!snoopy.risq.qc.ca!chi1.webusenet.com!c02.atl3!news.webusenet.com!news02.tsnz.net!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail