English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. Blitz Basic

 
 
Thread Tools
Old 05 February 2024, 10:40   #21
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,343
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.
Daedalus is offline  
Old 05 February 2024, 17:10   #22
DrkStarr
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.
DrkStarr is offline  
Old 05 February 2024, 19:21   #23
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,343
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.
Daedalus is offline  
Old 05 February 2024, 22:43   #24
DrkStarr
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
No where in manual under setting up Windows, or talking about Free, does it ever say that if you're using gadgets, you'll want to free them after freeing the window.

That hurt. Thanks for helping me through it.
DrkStarr is offline  
Old 06 February 2024, 15:24   #25
E-Penguin
Banana
 
E-Penguin's Avatar
 
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,214
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.
E-Penguin is offline  
Old 06 February 2024, 15:37   #26
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,343
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.
Daedalus is offline  
 


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 19:23.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.07129 seconds with 15 queries