Announcement

Collapse
No announcement yet.

Access violation on FDevice.free but only in IDE

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Access violation on FDevice.free but only in IDE

    Hey yo.
    This one is a little silly and might as well be some stupid thing that I did.. or rather certainly.

    When I close my app I get an Access Violation when FDevice.Free is called
    BUT : only during Debug mode in Delphi, not when I start it directly. And also the error disappears when I use TDeviceattribute.Debug on the device creation.

    I could of course easily ignore this and just keep the attribute active while debugging and later remove it for compiling a release version or even just skip FDevice.free completely,
    but it just bothers me since I think that I must have done something wrong. Everything seems to work. I also use the same rendering code in the editor as I use in the game engine but it doesnt happen in the editor.

    I am aware that this could be caused by a lot of things including a fluke on my PC setup (which I cannot test because I dont have Delphi installed anywhere else), but I wanted to ask if you know any tests I could do in order to get behind what is causing this. I tried to disable different things (Texture loading, Occlusion, Glassy models, drawable texture stuff) but only if I leave out the entire 3D rendering section the error disappears.

    Edit: I also can get rid of the error when I disable FTextureCabinet.Free at the end, then FDevice.free doesnt do any trouble.
    Last edited by Zimond; 05-10-2025, 11:29 PM.

  • #2
    First, please make sure to use latest version, which at a time of writing is 3.5.1. Since version 3.5, a new resource handling system has been added to detect memory leaks, which in Debug mode would tell you if you haven't released any of important resources. Second, please check debug output when you call FDevice.Free: if there are any leaked objects, it should write about it in the output view. Normally, however, leaking objects shouldn't trigger AV, so it could also be a sign of some overwriting or memory corruption. Also make sure to release resources in reverse order in which they were created. This is especially true for all objects that depend on the device, including the swap chain.

    Comment


    • #3
      It was the Freeing order. The Swapchain was too low in the order. Thank you very much.
      And yes, I updated to 3.51. And I also made use of the debug output. I found a situation where no samplerstate was specified with it.
      Last edited by Zimond; 05-13-2025, 03:42 AM.

      Comment

      Working...
      X