# Memory leak strategies?

**URL:** https://forum.castle-engine.io/t/memory-leak-strategies/1069
**Category:** Uncategorized
**Created:** [January 27, 2024, 8:01pm UTC](https://forum.castle-engine.io/t/memory-leak-strategies/1069 "2024-01-27T20:01:21Z")
**Posts on this page:** 5
**Page:** 2

<div class="post-metadata">

### Author: ![edj](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/edj/32/1701_2.png) [@edj](https://forum.castle-engine.io/u/edj)
#### Post date: [February 19, 2024, 4:12pm UTC](https://forum.castle-engine.io/t/memory-leak-strategies/1069/21 "2024-02-19T16:12:13Z")

</div>

Here is the terrainexe zipped, hopefully the forum lets it through. Mine in 32 bit starts out at like 175MB then drops to 145MB then starts marching up the memory at 0.6MB/sec.  
[terrainexe.zip](https://forum.castle-engine.io/uploads/short-url/dhJOFek2nOwsnRrmxTWekA4JceX.zip) (15.6 MB)  
My card is a radeon rx570, it has been a while since I’ve updated its drivers, so will do that.  
Compiled and run from the CGE editor, it still eats the memory, but only at 0.3MB/sec compared to running from Lazarus.

---

<div class="post-metadata">

### Author: ![eugeneloza](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/eugeneloza/32/12_2.png) [@eugeneloza](https://forum.castle-engine.io/u/eugeneloza)
#### Post date: [February 19, 2024, 4:24pm UTC](https://forum.castle-engine.io/t/memory-leak-strategies/1069/22 "2024-02-19T16:24:57Z")

</div>

> [@edj](#):
>
> My card is a radeon rx570

Oh, I’ve got RX560, so we’re very close. My drivers aren’t up to date, but not too old. I guess I updated them somewhere last year.

---

<div class="post-metadata">

### Author: ![edj](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/edj/32/1701_2.png) [@edj](https://forum.castle-engine.io/u/edj)
#### Post date: [February 19, 2024, 4:30pm UTC](https://forum.castle-engine.io/t/memory-leak-strategies/1069/23 "2024-02-19T16:30:07Z")

</div>

I am SO happy to report that updating the radeon driver to the latest (which is from jan23) has solved the memory leak in terrain example and my program!!

---

<div class="post-metadata">

### Author: ![michalis](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/michalis/32/3_2.png) [@michalis](https://forum.castle-engine.io/u/michalis)
#### Post date: [February 19, 2024, 5:06pm UTC](https://forum.castle-engine.io/t/memory-leak-strategies/1069/24 "2024-02-19T17:06:17Z")

</div>

Ha! Hooray! OK, so this was a memory leak in OpenGL implementation indeed.

P.S. If you’d like to display to users something like _“you seem to have Radeon drivers but too old, please upgrade”_ you can use properties of singleton `GLVersion` for this. See the `GLInformationString` output that summarizes various values from `GLVersion`. E.g. you can something like

```delphi
if (GLVersion.VendorType = gvArm) and 
   (GLVersion.VendorMajor < 10) then
  MessageOK('You hav ARM GPU with too old drivers, please upgrade your drivers.');

```

You can do it essentially anywhere – e.g. at `Start` of first view.

---

<div class="post-metadata">

### Author: ![edj](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/edj/32/1701_2.png) [@edj](https://forum.castle-engine.io/u/edj)
#### Post date: [February 19, 2024, 6:19pm UTC](https://forum.castle-engine.io/t/memory-leak-strategies/1069/25 "2024-02-19T18:19:41Z")

</div>

I put that in… for this it is gvAti and VendorMajor \< 24 as I imagine overlaying a mini view of a scene on the main view of the scene is common need.

[Previous page](https://forum.castle-engine.io/t/memory-leak-strategies/1069.md?page=1)
