Thread overview | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
August 09, 2017 GC operates in LIFO sequence? | ||||
---|---|---|---|---|
| ||||
Memory allocation and deallocation when an application is being completed in GC operates in FIFO sequence. Is there a possibility to shift GC memory deallocation to LIFO mode? It`s connected with the fact that GUI library (Qt) creates QApplication first, but GC destroys this object first when an application is being completed. This leads to the application failure. If the sequence of memory deallocation on LIFO is shifted, it will essentially simplify the cooperation with C++ libraries. |
August 09, 2017 Re: GC operates in LIFO sequence? | ||||
---|---|---|---|---|
| ||||
Posted in reply to MGW | On Wednesday, 9 August 2017 at 13:46:29 UTC, MGW wrote:
> Memory allocation and deallocation when an application is being completed in GC operates in FIFO sequence.
Not really, it operates in an undefined sequence... just whenever it gets around to it in scans.
If destruction order is important, you should use RAII or explicit destruction...
|
August 09, 2017 Re: GC operates in LIFO sequence? | ||||
---|---|---|---|---|
| ||||
Posted in reply to MGW | On Wednesday, 9 August 2017 at 13:46:29 UTC, MGW wrote: > Memory allocation and deallocation when an application is being completed in GC operates in FIFO sequence. > Is there a possibility to shift GC memory deallocation to LIFO mode? > > It`s connected with the fact that GUI library (Qt) creates QApplication first, > but GC destroys this object first when an application is being completed. This leads to the application failure. > If the sequence of memory deallocation on LIFO is shifted, it will essentially simplify the cooperation with C++ libraries. https://p0nce.github.io/d-idioms/#The-trouble-with-class-destructors |
August 09, 2017 Re: GC operates in LIFO sequence? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Guillaume Piolat | On Wednesday, 9 August 2017 at 15:47:17 UTC, Guillaume Piolat wrote:
> On Wednesday, 9 August 2017 at 13:46:29 UTC, MGW wrote:
>> Memory allocation and deallocation when an application is being completed in GC operates in FIFO sequence.
>> Is there a possibility to shift GC memory deallocation to LIFO mode?
>>
>> It`s connected with the fact that GUI library (Qt) creates QApplication first,
>> but GC destroys this object first when an application is being completed. This leads to the application failure.
>> If the sequence of memory deallocation on LIFO is shifted, it will essentially simplify the cooperation with C++ libraries.
>
> https://p0nce.github.io/d-idioms/#The-trouble-with-class-destructors
Is garbage collection even useful besides managing memory?
|
August 09, 2017 Re: GC operates in LIFO sequence? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Swoorup Joshi | On Wednesday, 9 August 2017 at 17:38:15 UTC, Swoorup Joshi wrote:
> Is garbage collection even useful besides managing memory?
Managing memory is GC's raison d'ĂȘtre.
|
August 09, 2017 Re: GC operates in LIFO sequence? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Swoorup Joshi | On Wednesday, 9 August 2017 at 17:38:15 UTC, Swoorup Joshi wrote:
> On Wednesday, 9 August 2017 at 15:47:17 UTC, Guillaume Piolat wrote:
>> On Wednesday, 9 August 2017 at 13:46:29 UTC, MGW wrote:
>>> Memory allocation and deallocation when an application is being completed in GC operates in FIFO sequence.
>>> Is there a possibility to shift GC memory deallocation to LIFO mode?
>>>
>>> It`s connected with the fact that GUI library (Qt) creates QApplication first,
>>> but GC destroys this object first when an application is being completed. This leads to the application failure.
>>> If the sequence of memory deallocation on LIFO is shifted, it will essentially simplify the cooperation with C++ libraries.
>>
>> https://p0nce.github.io/d-idioms/#The-trouble-with-class-destructors
>
> Is garbage collection even useful besides managing memory?
That is like saying "Is fire even useful besides heating things up?".
Alex
|
August 09, 2017 Re: GC operates in LIFO sequence? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Swoorup Joshi | On Wednesday, 9 August 2017 at 17:38:15 UTC, Swoorup Joshi wrote:
> On Wednesday, 9 August 2017 at 15:47:17 UTC, Guillaume Piolat wrote:
>> On Wednesday, 9 August 2017 at 13:46:29 UTC, MGW wrote:
>>> Memory allocation and deallocation when an application is being completed in GC operates in FIFO sequence.
>>> Is there a possibility to shift GC memory deallocation to LIFO mode?
>>>
>>> It`s connected with the fact that GUI library (Qt) creates QApplication first,
>>> but GC destroys this object first when an application is being completed. This leads to the application failure.
>>> If the sequence of memory deallocation on LIFO is shifted, it will essentially simplify the cooperation with C++ libraries.
>>
>> https://p0nce.github.io/d-idioms/#The-trouble-with-class-destructors
>
> Is garbage collection even useful besides managing memory?
Of course! Once a week it is useful! Else things start piling up and getting really smelly! Not very healthy!
|
August 10, 2017 Re: GC operates in LIFO sequence? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Swoorup Joshi | On Wednesday, 9 August 2017 at 17:38:15 UTC, Swoorup Joshi wrote:
>
> Is garbage collection even useful besides managing memory?
GC has the unique advantage of being a global owner, hence avoiding to encode ownership into types for memory (when you can use it).
|
September 24, 2017 Re: GC operates in LIFO sequence? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Guillaume Piolat | Hmmm. Find some useful information here. |
Copyright © 1999-2021 by the D Language Foundation