< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
When I create vertex buffer with Pool.Default with program running in fullscreen, dbmon.exe resports “stack back trace” error and memory unfree on exit of the program when ALT+TAB is done during the running of the program
It also crashes after certain times of ALT+TAB. Not error when changed to Pool.Managed.
Any advice
Thanks
JKMax

Static Buffer and Stack Back Trace error
markdrury
No, it's not a sample framework.
I have not make any assignment to
IsUsingEventHandlers. I tried set it to false, but the program then crashes when trying to ALT+TAB back IN.I had created as such ...
vbLineWC =
new D3D.VertexBuffer(typeof(VertexPositionWC),2,
device,
D3D.Usage.Dynamic | D3D.Usage.WriteOnly,
VertexPositionWC.Format,
D3D.Pool.Default );
(I did not attach any event for .Created)
and disposed as such ...
if
(vbLineWC != null) vbLineWC.Dispose();and it is before disposing device.
Somehow the program is ok, non-crash and clean memory dbmon report on exit, when I created in managed pool as such ...
vbLineWC = new D3D.VertexBuffer(typeof(VertexPositionWC),
2,
device,
D3D.Usage.WriteOnly,
VertexPositionWC.Format,
D3D.Pool.Managed);
Did I miss anything I have not done vertices init for a while and I might had forgotten correct init sequence during lost -> reset phase.
Any tip will be great.
Thanks
JKMax
RichB2005
Couple quick questions.. First, are you using the sample framework If yes, are you disposing/recreating the vertex buffer in the appropriate OnDeviceLost/Reset/Disposing If no, have you set the IsUsingEventHandlers property on the device to false Are you handling cleanup of the vertex buffer yourself, or relying on MDX (or the framework) to do it
Yalei Wang - MS
What is happening is this. When you alt-tab from the program, the device is lost, and behind the scenes that vertex buffer is disposed for you by MDX. When you alt-tab back into the program, that vertex buffer is recreated. You don't explicitly state it, but it sounds as if you're also recreating the vertex buffer, which would then lead to the issues you mentioned in the original post.
My suggestions are one of the following:
1) Hook the Created event and do all of your vertex buffer Lock/Unlock (or SetData) calls there, and only create the vertex buffer once (and then immediately call your Created event handler).. Look at Tutorial 2/3 in the SDK for an example of this.
2) Set Device.IsUsingEventHandlers=False and hook the DeviceLost/DeviceReset events and Dispose/Recreate your vertex buffers in there manually.
3) Use the sample framework and dispose/recreate your vertex buffers in the appropriate places there.