RenderGeometryMemoryKB ( )

Parameters

None.

Description

Returns the renderer's tracked geometry memory, in kilobytes.

Use this mesh-side companion to RenderTextureMemoryKB to compare tracked vertex, index and related buffer storage across level visits. Coverage and upload accounting follow the backend. WebGPU sizes, including Linux's native Dawn/Vulkan backend, are resource-size accounting rather than driver heap residency. Do not add cumulative uploaded bytes to current allocation figures.

Read after RenderWorld and Flip for the latest published frame; the query returns 0 before Graphics3D. Existing return values remain unchanged. Deferred retirement and reusable capacity can keep this number above a previous value after FreeEntity; repeat after normal work settles rather than treating every increase as a leak.

The debugger Memory view and MemorySnapshot give supported metrics explicit scope, availability and coverage without combining them into a process total. See the Memory reporting guide.

See also: RenderTextureMemoryKB, LoadMesh, FreeEntity, DrawRenderStats.

Example

; RenderGeometryMemoryKB Example
; ------------------------------

Graphics3D 640,480,0,2
SetBuffer BackBuffer()

SeedRnd MilliSecs()

camera=CreateCamera()
PositionEntity camera,0,3,-14

light=CreateLight()
RotateEntity light,45,45,0

; Space spawns unique asteroid meshes; C frees them all again
Dim rocks(49)
count=0

While Not KeyDown(1)

    ; Each press creates NEW sphere geometry, so committed memory grows
    If KeyHit(57) And count<50 Then
        rocks(count)=CreateSphere(32)
        PositionEntity rocks(count),Rnd(-6,6),Rnd(-3,3),Rnd(0,8)
        EntityColor rocks(count),130,120,110
        count=count+1
    EndIf

    ; C frees every spawned mesh, releasing its geometry memory
    If KeyHit(46) Then
        For n=0 To count-1
            FreeEntity rocks(n)
        Next
        count=0
    EndIf

    ; Arrow keys move the camera
    If KeyDown(200) Then MoveEntity camera,0,0,0.1
    If KeyDown(208) Then MoveEntity camera,0,0,-0.1
    If KeyDown(203) Then TurnEntity camera,0,1,0
    If KeyDown(205) Then TurnEntity camera,0,-1,0

    RenderWorld

    ; RenderGeometryMemoryKB tracks committed geometry and upload memory
    Text 0,0,"Space: spawn asteroid   C: free all   Arrows: camera   Esc: exit"
    Text 0,20,"Unique meshes: "+count+"   RenderGeometryMemoryKB() = "+RenderGeometryMemoryKB()+" KiB"

    Flip

Wend

End

Index