Thread overview | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
December 29, 2004 Garbage Collection | ||||
---|---|---|---|---|
| ||||
Can we have a way in Linux to not use the garbage collector at all? I know in Windows you have to write your own WinMain() function and explicitly turn on the garbage collector. Can we have some version flag that does this for Linux or some other similar method? I'd like to see what I can do with D without garbage collection. I know gc.disable() works, but I really don't want it to even start up initially. Also, what's the current status on DLLs (and Linux SOs) with D's garbage collector? Regards, James Dunne |
December 29, 2004 Re: Garbage Collection | ||||
---|---|---|---|---|
| ||||
Posted in reply to James Dunne | I'm very curious about that too. Perhaps I'm wrong, but it seems to me that the ability to opt-out of using the GC would be very beneficial on low-power/embedded devices. "James Dunne" <jdunne4@bradley.edu> wrote in message news:cqt2un$2ico$1@digitaldaemon.com... > Can we have a way in Linux to not use the garbage collector at all? I > know in > Windows you have to write your own WinMain() function and explicitly turn > on the > garbage collector. Can we have some version flag that does this for Linux > or > some other similar method? I'd like to see what I can do with D without > garbage > collection. I know gc.disable() works, but I really don't want it to even > start > up initially. > > Also, what's the current status on DLLs (and Linux SOs) with D's garbage > collector? > > Regards, > James Dunne |
December 29, 2004 Re: Garbage Collection | ||||
---|---|---|---|---|
| ||||
Posted in reply to James Dunne | "James Dunne" <jdunne4@bradley.edu> wrote in message news:cqt2un$2ico$1@digitaldaemon.com... > Can we have a way in Linux to not use the garbage collector at all? I know in > Windows you have to write your own WinMain() function and explicitly turn on the > garbage collector. Can we have some version flag that does this for Linux or > some other similar method? I'd like to see what I can do with D without garbage > collection. I know gc.disable() works, but I really don't want it to even start > up initially. It's all controlled by the library. Full library source is included, and you can remove the gc by simply deleting it from dmain2.d and rebuilding phobos. > Also, what's the current status on DLLs (and Linux SOs) with D's garbage > collector? Same as always ! |
December 30, 2004 Re: Garbage Collection | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | >
>It's all controlled by the library. Full library source is included, and you can remove the gc by simply deleting it from dmain2.d and rebuilding phobos.
>
Then how do you free memory allocated with new since there's no delete keyword? Do I have to go with C's malloc and free? Or just write my own memory management *shudders*?
Regards,
James Dunne
|
December 30, 2004 Re: Garbage Collection | ||||
---|---|---|---|---|
| ||||
Posted in reply to James Dunne | On Thu, 30 Dec 2004 06:55:32 +0000 (UTC), James Dunne <jdunne4@bradley.edu> wrote:
>>
>> It's all controlled by the library. Full library source is included, and you
>> can remove the gc by simply deleting it from dmain2.d and rebuilding phobos.
>>
>
> Then how do you free memory allocated with new since there's no delete keyword?
> Do I have to go with C's malloc and free? Or just write my own memory
> management *shudders*?
>
> Regards,
> James Dunne
>
Since there's no GC, I expect you wouldn't be able to use
new (runtime exception?)
P.S. I thought there was a delete keyword? Am I just stupid?
|
December 30, 2004 Re: Garbage Collection | ||||
---|---|---|---|---|
| ||||
Posted in reply to James Dunne | "James Dunne" <jdunne4@bradley.edu> wrote in message news:cr08p4$2na4$1@digitaldaemon.com... > > > >It's all controlled by the library. Full library source is included, and you > >can remove the gc by simply deleting it from dmain2.d and rebuilding phobos. > > > > Then how do you free memory allocated with new since there's no delete keyword? > Do I have to go with C's malloc and free? Or just write my own memory management *shudders*? There is a delete keyword! And yes, if you don't wish to use D's automatic memory management code, you'll need to manually manage it yourself. Using C's malloc/free is one way to do it. |
January 03, 2005 Re: Garbage Collection | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | In article <cr0i8v$5v$1@digitaldaemon.com>, Walter says... > > >"James Dunne" <jdunne4@bradley.edu> wrote in message news:cr08p4$2na4$1@digitaldaemon.com... >> > >> >It's all controlled by the library. Full library source is included, and >you >> >can remove the gc by simply deleting it from dmain2.d and rebuilding >phobos. >> > >> >> Then how do you free memory allocated with new since there's no delete >keyword? >> Do I have to go with C's malloc and free? Or just write my own memory management *shudders*? > >There is a delete keyword! And yes, if you don't wish to use D's automatic memory management code, you'll need to manually manage it yourself. Using C's malloc/free is one way to do it. > > Can I override the default behaviour of new/delete to use my own memory management? :):) If so, how and where? Thanks for the info! Regards, James Dunne |
January 03, 2005 Re: Garbage Collection | ||||
---|---|---|---|---|
| ||||
Posted in reply to James Dunne | This just occurred to me... Can we have two memory-management targets for D? One garbage collected (default), and the other manually managed with new/delete (compiler switch)? I'm sure you've got some nice C++ memory management code lying around ;) I also know you've got enough on your plate with this language to feed for a few years, so I'm just throwing in my $0.02. In article <cra8mt$pge$1@digitaldaemon.com>, James Dunne says... > >In article <cr0i8v$5v$1@digitaldaemon.com>, Walter says... >> >> >>"James Dunne" <jdunne4@bradley.edu> wrote in message news:cr08p4$2na4$1@digitaldaemon.com... >>> > >>> >It's all controlled by the library. Full library source is included, and >>you >>> >can remove the gc by simply deleting it from dmain2.d and rebuilding >>phobos. >>> > >>> >>> Then how do you free memory allocated with new since there's no delete >>keyword? >>> Do I have to go with C's malloc and free? Or just write my own memory management *shudders*? >> >>There is a delete keyword! And yes, if you don't wish to use D's automatic memory management code, you'll need to manually manage it yourself. Using C's malloc/free is one way to do it. >> >> > >Can I override the default behaviour of new/delete to use my own memory management? :):) If so, how and where? Thanks for the info! > >Regards, >James Dunne |
January 03, 2005 Re: Garbage Collection | ||||
---|---|---|---|---|
| ||||
Posted in reply to James Dunne | "James Dunne" <jdunne4@bradley.edu> wrote in message news:cra8mt$pge$1@digitaldaemon.com... > Can I override the default behaviour of new/delete to use my own memory management? :):) If so, how and where? Thanks for the info! Replace the gc code in the library with your own. All the source is provided! |
January 03, 2005 Re: Garbage Collection | ||||
---|---|---|---|---|
| ||||
Posted in reply to James Dunne | "James Dunne" <jdunne4@bradley.edu> wrote in message news:cra9hh$qe0$1@digitaldaemon.com... > This just occurred to me... Can we have two memory-management targets for D? > One garbage collected (default), and the other manually managed with new/delete > (compiler switch)? I'm sure you've got some nice C++ memory management code > lying around ;) I also know you've got enough on your plate with this language > to feed for a few years, so I'm just throwing in my $0.02. You can override new/delete on a per-class basis. |
Copyright © 1999-2021 by the D Language Foundation