05 February 2024, 10:40 | #21 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,419
|
Yep, putting Stop commands wherever you want the flow to stop in the debugger is very useful. The Trace mode of the debugger can be hard to follow as it executes as fast as it can - there's no delay between commands. Clicking Step will move a single command each time, so you need to keep clicking it to follow the program flow.
|
05 February 2024, 17:10 | #22 |
Registered User
Join Date: Aug 2022
Location: Detroit / USA
Posts: 37
|
I did get the debugger to pause using the right mouse button. I followed the code. It does look right. So I started stripping things away.
I got the error to reproduce by bouncing between 3 windows. The first page has 5 gadgets on it, the other two have 9 a piece. If I comment out the gadgets so there's only 1 on each page, the program runs smoothly. Running longer than the other with 23 gadgets. Running with 23 gadgets kills it. It sounds odd, but I think the Gadget are not being destroyed when the page is freed. I thought freeing the current window would destroy all the gadgets with it. But it doesn't feel like this is happening. I don't see a way to remove a gadget, except in Intuition. |
05 February 2024, 19:21 | #23 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,419
|
Ah, you're on the right track there indeed. Are you recreating the gadgets when you make a new window? That'll probably be stomping memory somewhere, and might account for the momentary freezing as it tries to allocate memory that's already been allocated.
You need to free the GTList before recreating it, which might sort out your issues. Just make sure you do things in the correct order - close the window first, then free the GTList. |
05 February 2024, 22:43 | #24 |
Registered User
Join Date: Aug 2022
Location: Detroit / USA
Posts: 37
|
Thanks for all the help. That was it. I needed to free the gadget list before redrawing the window.
Code:
Free Window currentWindow Free TextGadget currentWindow That hurt. Thanks for helping me through it. |
06 February 2024, 15:24 | #25 |
Banana
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,217
|
Modern languages like Java and Python sort out the freeing of resources for you, but you need to keep an eye on things with Blitz. It (apparently...) frees things on program exit but if you stop it in the debugger then I get the feeling things are not released. For every "create window" function you could have a corresponding "destroy window" that frees all of the things.
|
06 February 2024, 15:37 | #26 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,419
|
Yeah, it'll clean up on exit, but only then. It should still free objects when you stop it with the debugger, though I wouldn't 100% trust it.
Anything allocated while the program runs stays allocated until explicitly freed or until exit. I guess the confusing thing here is that disposing of a window doesn't automatically dispose of associated objects like GTLists, menus, bitmaps etc. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Random numbers | sparhawk | Coders. Asm / Hardware | 44 | 25 November 2020 22:16 |
Serial Numbers vs QC numbers question | 005AGIMA | support.Other | 1 | 05 January 2020 13:53 |
Fast floating-point random numbers | Leffmann | Coders. Tutorials | 27 | 25 August 2016 01:59 |
Help needed!!Random octal numbers generator(asm) | sheryn88 | Coders. General | 6 | 01 August 2010 07:19 |
A nice quick small random numbers routine? | Photon | Coders. General | 2 | 20 December 2004 21:56 |
|
|