924 – GC collects valid objects

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 924 - GC collects valid objects
Summary: GC collects valid objects
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 Linux
: P2 critical
Assignee: Walter Bright
URL:
Keywords:
Depends on:
Blocks:
Reported: 2007年02月02日 18:54 UTC by Frank Benoit
Modified: 2014年02月16日 15:22 UTC (History)
0 users

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Frank Benoit 2007年02月02日 18:54:01 UTC
This problem occurs, if an array is initialized with the static initializer:
import std.gc;
extern(C) int printf( char*, ... );
class C{
 ~this(){
 printf( "DTor()\n" );
 }
}
C[] carr;
void setup(){
 carr = [ new C, new C];
}
void main(){
 setup();
 fullCollect();
 printf( "complete\n" );
}
// expected output
complete
DTor()
DTor()
// but it is
DTor()
DTor()
complete
Comment 1 Walter Bright 2007年02月12日 03:46:47 UTC
Fixed DMD 1.005
Comment 2 Thomas Kühne 2007年02月15日 03:42:33 UTC
Added to DStress as
http://dstress.kuehne.cn/run/m/memory_management_06_A.d 


AltStyle によって変換されたページ (->オリジナル) /