Garbage Collection

Hi
I would like to know wat does VC++do for garbage collection .I guess Java has a very versatile and
strong GC.How about VC++.Wat are the new MFC's availabel with VC
0
anonymous (74722)
3/3/2004 4:21:07 AM
vc.mfc 33608 articles. 0 followers. Follow

6 Replies
1095 Views

Similar Articles

[PageSpeed] 58

The problem with garbage collection is that you have to be able to find all the pointers,
and C and C++ don't make this easy. So there is no general-purpose garbage collector
possible.

Within restricted problem domains, there are GC libraries for C and C++, and if you write
a pure managed-code MFC app you get the C# garbage collector free.
				joe

On Tue, 2 Mar 2004 20:21:07 -0800, "CJ" <anonymous@discussions.microsoft.com> wrote:

>Hi 
>I would like to know wat does VC++do for garbage collection .I guess Java has a very versatile and 
>strong GC.How about VC++.Wat are the new MFC's availabel with VC

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
3/3/2004 4:58:05 AM
Unless you move to .Net framework, there is no garbage collection. MFC does
not provide this functionality.

--
Ajay Kalra [MVP - VC++]
ajaykalra@yahoo.com


"CJ" <anonymous@discussions.microsoft.com> wrote in message
news:E7D7644F-D9E0-4D62-B033-3CEB92E9BD6E@microsoft.com...
> Hi
> I would like to know wat does VC++do for garbage collection .I guess Java
has a very versatile and
> strong GC.How about VC++.Wat are the new MFC's availabel with VC


0
ajaykalra (6842)
3/3/2004 5:15:43 AM
"Joseph M. Newcomer" <newcomer@flounder.com> wrote:
> The problem with garbage collection is that you have to be able to find
all the pointers,
> and C and C++ don't make this easy. So there is no general-purpose garbage
collector
> possible.
>
I have not used any of the GCs availble but I have always thought that they
were general in that they can be seamlessly integrated into your app.
Isn't that the case? What special steps needs to be taken to integrate one
of those GCs into an app?

/Tommy




0
someone913 (592)
3/3/2004 10:21:47 AM
VC++, by design doesn't support any garbage collectors. If you want, you can
always implement a garbage collector in your app.
You can start exploring in this domain from "Smart Pointers"  and
std::auto_ptr. I have seen some smart pointer implementations which using
reference counting. A reference count is maintained that's incremented when
the smart pointer is copied and decremented when the smart pointer is
destroyed. If the reference count ever reaches zero the object is finally
destroyed.

But these "smart pointers" will fail incase of circyular references. Say if
you have an object OBJECT1 with a reference counted pointer to another
object OBJECT2, and OBJECT2 has another reference counted pointer pointing
to OBJECT1, then neither of them will get deleted. In situations like this,
you will have to use "weak pointers"( normal C++ dumb pointers).

Anyway there are several free implementations of GCs which you can use.

Cheers
Jagadeesh

"CJ" <anonymous@discussions.microsoft.com> wrote in message
news:E7D7644F-D9E0-4D62-B033-3CEB92E9BD6E@microsoft.com...
> Hi
> I would like to know wat does VC++do for garbage collection .I guess Java
has a very versatile and
> strong GC.How about VC++.Wat are the new MFC's availabel with VC


0
jagadeeshvn (256)
3/3/2004 11:25:01 AM
I've not been aware of any "seamless" way to integrate a GC into C or C++. The languages
don't permit this. To integrate a GC into an app you need to make every pointer to a data
structure visible to the GC, so it can find all the rooted segments. This requires that
you change your programming style. You can't just store pointers any longer. There is no
way for the GC to find them. Presumably there would be some C++ "smart pointer" classes
that you could use to automate some of this in C++, but it means you have to change your
app to use them.
				joe

On Wed, 3 Mar 2004 11:21:47 +0100, "Tommy" <someone@microsoft.com> wrote:

>"Joseph M. Newcomer" <newcomer@flounder.com> wrote:
>> The problem with garbage collection is that you have to be able to find
>all the pointers,
>> and C and C++ don't make this easy. So there is no general-purpose garbage
>collector
>> possible.
>>
>I have not used any of the GCs availble but I have always thought that they
>were general in that they can be seamlessly integrated into your app.
>Isn't that the case? What special steps needs to be taken to integrate one
>of those GCs into an app?
>
>/Tommy
>
>
>

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
3/3/2004 4:10:56 PM
"Ajay Kalra" <ajaykalra@yahoo.com> wrote in message
news:emdwY6NAEHA.712@tk2msftngp13.phx.gbl...
> Unless you move to .Net framework, there is no garbage collection. MFC
does
> not provide this functionality.


MFC should be augmented to include smart pointers, for this reason.

-Mark


0
mrr9342 (25)
3/3/2004 7:10:54 PM
Reply:

Similar Artilces:

Receiving Multiple Emails but not using pop collection
Ok, here goes... Server 2003 Standard. Exchange 2003 Standard. We use SMTP to send and receive email. 4 of our users have been setup to have their email forwarded to individual external accounts with their own ISPs. However, when these users send emails to each other internally and cc each other (so user 1 sends an email to user 2 and ccs user 3 and 4), there will be 4 copies of the same email within their external accounts. Their internal exchange mailboxes will have only 1 copy, as it should. Why, then, do they get 4 copies in their external email accounts? I read other posts about simila...

Save as garbage (HTML)
In Office rather Excel 97 I can't seem to get the save as HTML to save my documents as they were in Excel. This function copies everything...hidden files and all and also out of proportion. Does anyone know how to fix this or why it's happening? Thanks......Tim ...

Collecting system information
Anyone know of a way for collecting all sorts of information on a system. I guess I'm looking for a way to pick up the information that you would normally find on the BIOS, like mainboard info, chipset info, RAM, AGP settings, CPU, CPU clock, .... I know how to get some like RAM and CPU, CPU clock, but I don't know about the rest. How do programs like CPUZ, PC Wizard, and others do it? An easy to use lib would be nice. Hanna-Barbera wrote: > Anyone know of a way for collecting all sorts of information on a system. > I guess I'm looking for a way to pick up the informati...

collection obj
I'm having some trouble with the collection obj. My first time out. I seem can't test it. (placing strings into what I would call a hash/dictionary. Am I doing that?) Dim usedFields As Collection Set usedFields = New Collection usedFields.Add("string); ' doesn't die Later, I want to know if an item exists if usedFields.Item("string") if exists.usedFields ... if usedFields.Item("string") <> "" if usedFields.Item("string") <> 0 All get me the yellow bug line. How do test for exists? Help. Than...

Puma Men's Motor Sport Collection Top Podium Ana-digit Watch #PU100041003
Price:$250.00 Image: http://bestdeallocator.info/image.php?id=B0017O8WFS Best deal: http://bestdeallocator.info/index.php?id=B0017O8WFS I just received this watch as a graduation gift from college. It looks absolutely incredible! Very unique design with a very sturdy, solid band and large face. I love that it features both digital and analog readouts. Before getting the watch I was a little confused about the multiple dials, now I understand and can relate them to anyone else who is curious. On the left hand side of the watch is the digital display featuring time, date and seconds....

create a form that collects parameters
Hi, i need a form where we search for a detail and the result should be published in the bottom, based on the result the user will decide what to do next in acess 2007. i refered the link below http://office.microsoft.com/en-us/access/HA100963141033.aspx#form_param in this some mistake is there in the macro can somebody help me out. if any template for search form is available please let me know. thank you, -- Kalai Kalai wrote: >i need a form where we search for a detail and the result should be >published in the bottom, based on the result the user will decide w...

How to store the lengthy value in Series collection?
Hi, I have one bar chart. I could not able to store the lengthy values in series collection. Because Series collection text box could accept limitted characters only. How to Store the lengthiest value in to series collection like this? (Data2!$F$3,Data2!$F$5,Data2!$F$9,Data2!$F$11,Data2!$F$14,Data2!$F$15,Data2!$F$16,Data2!$F$19,Data2!$F$20,Data2!$F$21,Data2!$F$22,Data2!$F$23,Data2!$F$24,Data2!$F$25,Data2!$F$36,Data2!$F$37,Data2!$F$38,Data2!$F$39,Data2!$F$40,Data2!$F$41,Data2!$F$42,Data2!$F$43,Data2!$F$44,Data2!$F$45,Data2!$F$46,Data2!$F$47,Data2!$F$48,Data2!$F$49,Data2!$F$50) Note: I have...

Tax Collected Question
Is there a report to run that will show the tax that has been paid by the customer and not on the tax that was collected via a tender? Or is there a report to run that shows invoices have been paid by check, credit card, or cash that leaves out those tendered to account? We would like to be able to pay taxes on what has been paid to us and not what we are waiting on for payment. hi send me your email I will forward you some interesting reports for your below issue. "bevans22" wrote: > Is there a report to run that will show the tax that has been paid by the > custome...

Collection of a class to use as worktable
Hi, I need some kind of unbound table in which i can add and edit items I must be able to read items by ID and update some fieldvalues. At the end of the program i will have to read all items of this table and use the values to update some "real" (other) tables So i need some kind of 'worktable' to store my data temporary I think i have to make a class in which i define my fields of my worktable and then work with some collection of that class, but i don't quite know exactly how to do this Someone who can give me some hints in what i should use? Thanks,...

How can I delete an infinite number of garbage cells to the right
I highlighted many entire rows with color. Now my excel wants to print 115 pages. I can define a narrow print area, but I really want to delete the garbage color cells to the right. When I drag to the right, there seems to be an infinite number of cells. hi don't drag. place your curser in the first row and column that you want to delete left. hold the shift key down with left hand and with right hand, hit end then the down arrrow. hit the end key again then the left arrow. excel will select all cells from row 1 to bottom and from curser position in row 1 to far left. ...

Speed to iterate through collection of elements
Hi everyone! I have a structure like this; struct myStruct { float x; float y; }; Now the elements are added to this CArray by calling the add function. The problem here is speed. This CArray might end up with a size of 10k maybe more, and EVERY time a new element is added, I need to iterate through all elements one by one. My question is therefore; Is there any faster way to store these elements that reduce the time to iterate all elements? For instance I am thinking about std::vector, pointers to myStruct in CArray or vector, CMemFile, Lists or anything else. What would yo...

Collections Management Subject
Currently, Great Plains is not designed to email graphical reports using Letters and Invoices (only Statements). Customer wants to be able to print graphical reports using Letters and Invoices not just Statements. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http:/...

for ... loop through file collection instead of for each ... loop
I would like to list all filenames in a file collection without using for each ... next but a for .. next loop instead. Could someone help me? Thanks in advance. Ranah ------- Set filesys = CreateObject("Scripting.FileSystemObject") Set demofolder = filesys.GetFolder("c:\") Set filecoll = demofolder.Files for n = 0 to filecoll.count-1 step 2 msg = msg & filecoll.item(n).name & VbCrLf next msgbox msg The VBScript documentation isn't very good on this subject. I typically attempt to get a count or length property for things like this. ...

Collect data from spesific cell in multiple sheets
How can I collect data from cell A1 on sheet 01.01 thru 31.12 (Dates) to summary sheet? I've tried fill and copy formula with different use of ! and $ but I've not been able to solve this by my self. Thank you Hi, The correct syntax is =SUM(Sheet1:Sheet3!A1) Substitute sheet1 & sheet3 for the first/last sheets in the range you want to sum -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question. "Espen Rostad" wrote: > How ...

Missing Collections Letters
I've upgraded to v9.0 from v8 and have lost the collection letters in the Letter Writing Assistant. I have been unable to figure out how to get them back in the list of available letters. The actual .doc files are still located in the file system, just not in the LWA list. Thanks ...

Collection Letters Mail Merge in MS Word
In GP 9, mail merge function AllInvoicesDetail in Word prints out Invoice number, Invoice Due, Amount. If there are invoice numbers with different lengths then the alignment of the columns Invoice Due, and Amount appear staggered. We would like to see separate mail merge functions for Invoice number, Invoice Due, Amount. This will allow us to separate the columns by using tabs and get alignment. Many thanks. Rod ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agr...

Zero Length String and Garbage
I have an Access 2007 database that is linked to tables stored in an Interbase/Firebird (version 1.5) database. Any fields with zero length strings in them are displayed as garbage (eg: "=C3=82=E7=B7=AA=EA=94= =92=E4=83=A34 "). I do not think the problem is with the ODBC driver, because other applications that use the same driver do not show these problems. Unfortunately, I cannot change the data in the linked table, because it is generated by a third party application, and may cause problems if I change any of the data stored in the linked table. Does anyone have any i...

Collection with members of Great_Plains
Hello. How I can load or fill a collection with the members of project Great_Plains that correspond to the added fields? Thanks. ...

Data Collector Sets Not Collecting Data
When I create a new data collector set from performance monitor, everything seems to go well. The DCS is created and when I export the DCS to an .xml template, all the counters are there. The DCS Starts, but won't collect any data. Even if I create the DCS manually and add counters manually, it still doesn't seem to do anything. I have made sure it's running with credentials of a perf log user group member (and an administrator). The output file that's created is around 300 KB. It just holds no data. When I used the 'export' choice against the DCS, I get a...

Can I Order My Collection?
All, If I want to build a collection in a specific order, and I'm filling it from a TableAdapter whose source query I can not change, how would I put it in the order of one of the columns in the underlying query? I've tried various things as spelled out in my book and other sources, but nothing seems to "recognize" a column name. Here's what I have; Me.QRY_ButtonsTableAdapter.ClearBeforeFill = True Me.QRY_ButtonsTableAdapter.Fill(Me.L55TimerDataSet.QRY_Buttons) Dim Row As Integer = 0 Dim ButRecds = L55TimerDataSet.Tables("...

PSA: collected thoughts on where we go from here
I put a page on my site that attempts to collect my understanding of the situation and thoughts other users may want to consider as they deal with Microsoft's abandonment of Money. See http://umpmfaq.info/MoneyNextNot.htm if you are interested. Great . Thanks. Only one thing to think about...is that by Jan 2011 we may not have any better options than we have now....But thanks Marc "Dick Watson" wrote: > I put a page on my site that attempts to collect my understanding of the > situation and thoughts other users may want to consider as they deal with > Mic...

Help with Raw Stock Data Collection
Is it possible to have Excel search through 1 minute raw data and be able to determine if the price moves between a certain boundary for a certain time then it will be classified as "Type 1". And if it is increasing for a certain time then it will be "Type 2" and likewise for when it is decreasing. I want Excel to be able to automatically search through the raw data and determine what is the type of state without myself having to manually pinpoint it on the chart then going back and doing a manual search and calculation in Excel. Only issue is that the exact number determi...

Collect Data via Email
Im doing planning for a training project. Basically we have a bunch of training sessions and now need to book employees on the training. The employee has a choice re the date that he/she wants to attend. So we want to send an email with the options to the employees and then capture the replies in the db. I believe Access 2007 can do that and i watched the demo. Thats all great but heres the catch. There are only so many seats available in each session. Lets call it 30 seats. Is there a way that access can send the employee an email to say that "The session you ha...

How to implement IDictionary with <int, MyClass> members for custom Collection Object?
I found public class SimpleDictionary : IDictionary for creating a custom collection object at this site: http://msdn.microsoft.com/en-us/library/system.collections.idictionary.a spx The following is a simple class called MyClass (followed by SimpleDictionary : IDictionary). I can add MyClass objects to SimpleDictionary as is. But if I add the following members to IDictionary <int, MyClass> -- then my test app complains that I am not implementing the members. How do I emplement these members <int, MyClass> ? public class MyClass { public int EmpID; ...

Problems in copying a Collection to another and removing elements from two Collections
Hi, two questions on Collections: 1. in VBA, the only way to copy the items (not just the references) of a collection c1 to another collection c2 is to go through each element of c1 with a For Each Next and Add each item to c2, right? 2. I have a collection c1 containing some objects to be deleted (the ones for which the Defective property is True). I want to delete them from c1 and at the same time to delete the objects in the same position from another collection c2. See code below: Sub RemoveDefectivesfromColns(c1 As Collection, c2 As Collection) Dim obj as Object, I As L...