Results 1 to 2 of 2

Thread: Out Of memory

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2001
    Location
    Egypt
    Posts
    179

    Out Of memory

    Hello,

    I have the problem of "Out of memory".
    I am using VB6 SP5.
    This problem doesn't happen at the first time I run the program, It always happen after running
    the program and Ending it for about 7 to 10 times. After "Out of memory" appears at the last time,
    I have to close VB and run it again, some times I have to restart my machine.
    This problem is more noticed in Win 98 than Win NT or Win 2000.

    Now, I will tell some details about my program, so you can help me find a solution.

    My program Is a multimedia program, that uses several ActiveX controls I have made, These ActiveX
    controls are Controls that load many pictures, for example, my Listbox ocx has 3 pictures to be loaded
    for each of Up arrow , Down arrow, Left arrow, right arrow, Vertical Scroller and Horizontal Scroller.

    In UserControl_Initialize event I set the variables that I store pictures in it to null picture,
    The same I do in UserControl_Terminate event, like that:

    Set mvarUpMouseOutPicture = LoadPicture("") ' The picture of the Up button when the mouse out of the control
    Set mvarUpMouseUpPicture = LoadPicture("") ' The picture of the Up button when the mouse enters the control
    Set mvarUpMouseDownPicture = LoadPicture("") ' The picture of the Up button When the user press the mouse down on the control
    .
    .
    .
    .

    And so on, about 16 variant variable are set the same at UserControl_Initialize and UserControl_Terminate events

    I noticed that UserControl_Terminate is not fired when "End" statement Executed, but
    Unload the form will fire UserControl_Terminate, so the pictures variables will be freed.

    Does this describe the problem cause, or there are another reasons for this problem.

    Thank you for your time you have spent reading all of this message...

  2. #2
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Undocumented and "un-ended" (meaning that there is another call to make to free the memory) API calls do this. Make sure there are none of those. Eg. CreateDC requires a DeleteDC or ReleaseObject or something of the sort. Also, I believe you can set the pictures to Nothing. This would free up the memory (better?) than the loadpicture("").
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width