WaveWidget Userdata area ---> is there a memory leak? [message #5033] |
Sat, 09 September 1995 00:00 |
Juergen Paff
Messages: 3 Registered: September 1995
|
Junior Member |
|
|
Hi there,
I am having a problem with the userdata area of WaveWidgets. If this is
updated/overwritten by some new values, it does not seem to free the
now unused 'old' memory area. Thus a continuous refresh of userdata areas
(I need that to make my widgets reentrant) ultimately eats up all memory,
leading to exeeded process quotas (VMS) or swapping/freezing the mashine
(Unix).
Most things I know about Motif programming is from designing widgets with
Wave. Thus I do not know whether Wave or the MWM is responsible for this
'leak'. I tried to find the correspondig structure definitions in the
Motif Programmers Reference/Guide: didn't succeed.
If anybody could explain me this annoying feature, could point me to some
appropriate documentation, or has hints how to avoid this problem (common
blocks don't work for me), I'd certainly be very grateful.
Thanks a lot in advance ............. Juergen
Here's an example; it was tested under VMS with WaveAdv 5.0
(similar code got rid of all free mem on a SGI, also Wave 5).
********************* <snip> *********************************
;;;;;;;;;; callback that allocates memory ;;;;;;;;;;;;;;;;;;;;
pro bt_cb, wid, data
; retrieve array that is stored in userdata-area of widget:
userdata_array=WtGet(wid, /userdata)
; show memory usage
info, /mem
if n_elements(userdata_array) eq 1 then begin
; First call to bt_cb: userdata_array is not yet initialized
status=WtSet(wid, userdata=findgen(500000))
endif else begin
; If there was data in the userdata area, just write it back
status=WtSet(wid, userdata=userdata_array)
end
end
;;;;;;;;;;;;;;;;;;;; main routine ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
pro eatmem
; Create a ne top level widget
main=WwInit('eatmem', 'my_lib', layout, /form)
; Create a button
but=WwButtonBox(layout, 'Press_me_to_eat_up_mem', 'bt_cb')
; Display the widget
status=WtSet(main, /realize)
; Start Event loop
WwLoop
end
********************* <snip> *********************************
------------------------------------------------------------ ------------
Juergen Paff | Phone: +41 1 6324343 or +41 1 6324433
Laboratorium fuer Phys. Chemie |
ETH Zuerich (Zentrum) | Fax: +41 1 6321021
CH-8092 Zuerich, Switzerland | E-mail: paff@ir.phys.chem.ethz.ch
------------------------------------------------------------ ------------
|
|
|