Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Memory not freed

Memory not freed

Memory not freed

In an application I have a task that keeps consuming memory until it crashes. Watching with processExplorer I found that the following function allocates approxmiately 50MB every time it is called (it is called 30 times). This memory is not freed when the function exits, even if I call GarbageCollect. Note that Functions called like Of_IsOrario, Of_GetCell, Of_GetRowCount, Of_GetColCOunt just return values (they do not allocate memory)

CODE --> PowerBuilder

long ll_file, i, j, ll_bytes, ll_fileWithTitles 
double ld_value 
string ls_line 
n_cst_string str 

ll_fileWithTitles = FileOpen( as_fileName + "text.txt", LineMode!, Write!, Shared!, Replace!, EncodingAnsi!) 
ll_file = FileOpen(as_fileName, LineMode!, Write!, Shared!, Replace!, EncodingAnsi!) 

if ll_file < 0 then 
        MessageBox("Σφάλμα", "Could not create file " + as_fileName) 
        return false 
end if 

for i = 1 to Of_GetColCount() 
        if in_tasks[i].Of_IsOrario() then 
                ls_line += "~tO" + in_Tasks[i].is_symbol 
                ls_line += "~t" + in_Tasks[i].is_symbol 
        end if                 
FileWrite(ll_fileWithTitles, ls_line) 

for i = 1 to Of_GetRowCount() 
        ls_line = "" 
        for j = 1 to Of_GetColCount() 
                ld_value = -Of_GetCell(i, j) 

                if ls_line <> "" then ls_line += "~t" 
                ls_line += string(ld_value) 
        ls_line = str.Of_GlobalReplace(ls_line, ",", ".") 
        if IsNull(ls_line) then 
                ls_line = ls_line 
        end if 
        ll_bytes = FileWrite(ll_file, ls_line) 
        ls_line = string(in_matrix[i].il_agentId) + "~t" + ls_line 
        ll_bytes = FileWrite(ll_fileWithTitles, ls_line) 

return true 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close