[Gambas-devel] Memory leak of GB.ReturnNewZeroString()?
tobias at ...692...
Wed Feb 6 00:16:09 CET 2013
I used to call GB.ReturnNewZeroString() to return a copy of a C string on
the stack from Window.Ask() in gb.ncurses. Now this is the situation:
Window.Ask() gets called twice in nested functions and the return value is
given to the SELECT-CASE control structure (in my Pong program).
a) QUIT (by an event) within both nested functions give me "4 allocation(s)
non freed". If I remove any of the Window.Ask() calls, I get only 2 non-
freed allocations and with both removed, everything is fine.
b) When using Ctrl-C to kill the program mid-execution, the program is also
cleaned up properly.
c) When QUIT (by the same event as in a)) outside of the _inner_ function,
_no_ memory leaks are reported.
Do you understand the problem ad hoc?
Looking at gb.crypt source code, I seem to use GB.ReturnNewZeroString()
correctly at least. I fixed the problem by simply making Window.Ask() return
the number of the choice as an Integer. This makes also project translation
However, if you want I could try to replicate the offending code so that you
can have a look.
More information about the Devel