TIP: Click on subject to list as thread! ANSI
echo: visual_basic
to: All
from: Ian T
date: 2004-12-02 05:51:00
subject: Re: Setting Recordsets to

David C. Barber wrote:
> Why is it that after I close an ADO recordset defined locally
> 
>     Dim adoRS as New ADODC.Recordset
> 
> that so many examples insist that I should set it to nothing as well?
> 
>     adoRS.Close
>     Set adoRS = Nothing
>     Exit Sub
> 

Presumably so that the internal memory manager releases the object from 
the heap.

 > Isn't it sufficient to have it go out of scope when I exit the 
subroutine?

Probably not, but maybe. Since the internals of memory management in VB 
are not published, it's hard to know when objects are discarded from the 
heap.

If it were C++, then an object instantiated with New would need to be 
deleted by the programmer. Given that VB is not written in VB, one 
assumes that the same rule applies.

Ian
---
þ RIMEGate(tm)/RGXPost V1.14 at BBSWORLD * Info{at}bbsworld.com

---
 * RIMEGate(tm)V10.2áÿ* RelayNet(tm) NNTP Gateway * MoonDog BBS
 * RgateImp.MoonDog.BBS at 12/2/04 5:51:56 AM
* Origin: MoonDog BBS, Brooklyn,NY, 718 692-2498, 1:278/230 (1:278/230)
SEEN-BY: 633/267 270 5030/786
@PATH: 278/230 10/345 106/1 2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.