🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #11678

Re: std::string to BSTR conversion function leaks memory... (Urgent please)

#11678
From: Ed Mulroy [TeamB]
Date: Fri, 16 Jan 2004 22:32
34 lines
2604 bytes
> VB does have a primitive (reference count) garbage collector.

Depending upon how the code was written the garbage collector may not be
involved.  The collector may handle normal VB allocations, but not
necessarily ones requiring that SysFreeString be called and in fact if it
does not handle it, what you suggest is happening is the exact result one
could expect.  The code you showed has no memory leak.  Look at the VB code.

.  Ed

> Fernando wrote in message
> news:2j7g0012sja7vhngl777130qbb0sp4163k@4ax.com...
>
> >I do not know that Visual Basic handles it automatically.
>
> VB does have a primitive (reference count) garbage collector.
>
> >  It all depends
> >upon the code the writer of the VB part used.
>
> That's me. :-) I just call the function and save the result in a VB string
> (BSTR).
> >You said that CodeGuard did not find any leaks yet there is a memory
leak.
> >How do you determine that there is a memory leak?
>
> Well... actually CodeGuard doesn complain if I call that function from
with a
> test exe (within the BCB ide). However, if I create a dll (with code guard
> enabled) and call it from VB, then I do get a messagebox from CodeGuard
> complaining about a memory leak. :-?
>
> If I run the VB code that call that function in the dll in a loop, memory
> usage goes up pretty quickly.
Technical Details
Message-ID: <40086666$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!peernews3.colt.net!newsfeed00.sul.t-online.de!t-online.de!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <bjlf005pg85nvabmpc7ksd5ugs624tua53@4ax.com> <4008039f$1@newsgroups.borland.com> <u11g001tat37jadh02pfhdvqk99lf85p0s@4ax.com> <40081253$1@newsgroups.borland.com> <2j7g0012sja7vhngl777130qbb0sp4163k@4ax.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,61db49fd5c05f5b0
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-01-16 14:35:36 PST
From: "Ed Mulroy [TeamB]" <dont_email_me@bitbuc.ket>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <bjlf005pg85nvabmpc7ksd5ugs624tua53@4ax.com> <4008039f$1@newsgroups.borland.com> <u11g001tat37jadh02pfhdvqk99lf85p0s@4ax.com> <40081253$1@newsgroups.borland.com> <2j7g0012sja7vhngl777130qbb0sp4163k@4ax.com>
Subject: Re: std::string to BSTR conversion function leaks memory... (Urgent please)
Date: Fri, 16 Jan 2004 17:32:04 -0500
Lines: 36
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 24.74.175.102
Message-ID: <40086666$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1074292326 24.74.175.102 (16 Jan 2004 14:32:06 -0700)
X-Authenticated-User: edmulroy
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!peernews3.colt.net!newsfeed00.sul.t-online.de!t-online.de!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail