Oxygen Basic

Programming => Example Code => Topic started by: Peter on February 21, 2013, 01:54:23 PM

Title: SimpleWindow update 22.o2.2o13
Post by: Peter on February 21, 2013, 01:54:23 PM
deleted
Title: Re: SimpleWindow update 22.o2.2o13
Post by: JRS on February 22, 2013, 12:06:30 PM
Hope is still alive.

Thank You!
Title: Re: SimpleWindow update 22.o2.2o13
Post by: JRS on February 22, 2013, 12:35:13 PM
I only have one word of advice.

BACKUP
Title: Re: SimpleWindow update 22.o2.2o13
Post by: JRS on February 22, 2013, 01:01:10 PM
Peter,

I was wondering if Simple Windows can load an animated .gif and let it do its thing without having to be maintained by the event loop?

John

NO, I'm not turning into a gamer.  ;)
Title: Re: SimpleWindow update 22.o2.2o13
Post by: JRS on February 22, 2013, 04:02:24 PM
scribaw doesn't work with DYC.

I regenerated a new version of ScriptBasic for Windows without the manifest. (scribaw2k.exe) It works with IUP applications using the ScriptBasic extension module but exception errors running SokoMouse via DYC. Just use scriba.exe from the console to run the game for now.

I attached the IUP Online Dictionary example as a .exe with both scribaw.exe (dictman.exe) and scribaw2k.exe (dictw2k.exe). Neither of these examples pop a console window when run. Charles has been playing with DYC and maybe he knows why certain API calls cause SB to fail.



X
Title: Re: SimpleWindow update 22.o2.2o13
Post by: JRS on February 23, 2013, 04:46:21 PM
Quote from: JRS
Hope is still alive.

Quote from: Charles
Bstring/Zstring conversions now working:
They are sent and received as long values

DLLC
Code: [Select]
mysbstring = dllzstr (mybstring)
mybstring = dllostring ( mysbstring)

I find this interesting. This is the only way I can pass a string variable to SW. I can not assign that variable anything other than a quoted string or pass it a quoted string or it exception errors.

Code: [Select]
BmpText fo, 520, 420, Nums[lev], 24, 24

Peter,

I was so wrapped up in performance that I didn't even notice the program was consuming memory at a fairly rapid rate. What do I need to free in each iteration of the event loop to stop the leaking?

Title: Re: SimpleWindow update 22.o2.2o13
Post by: Charles Pegge on February 23, 2013, 10:15:41 PM
Hi John

When a function returns a Bstring it is the callers responsibility to dispose of it.

Using DLLC When you receive a Bstring then convert it to an SB string, the Bstring will be freed automatically.

I will also add another function to DLLC for explicitly freeing Bstrings

mybstring=dllostr("ABCDEF")

dlldelo(mybstring)

Title: Re: SimpleWindow update 22.o2.2o13
Post by: JRS on February 23, 2013, 10:48:25 PM
Quote
When a function returns a Bstring it is the callers responsibility to dispose of it.

The SokoMouse game isn't calling any Simple Windows functions that return strings. I only pass quoted strings to the library. (only during init)

Glad to hear that DLLC has good house keeping habits.

@Peter

Just to make sure SB doesn't have leaking issues, I ran this at full bore for 5 minutes (100% CPU) and the memory usage level never budged.

Code: [Select]
SUB me
  FOR x = 1 to 1000
    b = x
  NEXT
END SUB

a = 1
WHILE a
  me
WEND
Title: Re: SimpleWindow update 22.o2.2o13
Post by: JRS on February 23, 2013, 11:41:58 PM
Quote
Memory leaks?
Do you have an example  what shows me what you  do?

Just run the SokoMouse game in SB (maybe O2 as well) with task manager and watch the memory keep climbing.
Title: Re: SimpleWindow update 22.o2.2o13
Post by: Aurel on February 24, 2013, 12:47:21 AM
I don't see any problem with memory to,only processor is on 100%
Title: Re: SimpleWindow update 22.o2.2o13
Post by: Charles Pegge on February 24, 2013, 05:17:27 AM
I think its a bstring interfacing problem with DYC
Title: Re: SimpleWindow update 22.o2.2o13
Post by: JRS on February 24, 2013, 09:37:39 AM
I would have to agree. As I removed Simple Windows functions in an effort to isolate what function might be causing the issue, the memory usage reduced as the functions ceased to be called. I thought it was only functions that passed stings back to SB would cause leaks but it seems passing strings (quoted) to SW without the underline support from O2 for cleanup is the problem. I'll give SW another look after DLLC is introduced.