Hi Alex,
There could be any number of reasons why this could be happening, and obviously
some down to coding, however if you are using caching at all, then it maybe
down to how long you've told the cache to keep the models, even when not used.
I can't remember what the default is, but if set to never get rid of the
models, then the only time their memory will be released is when the
application shuts down - not merely closing and destroying the window.
This leads on to another reason why you maybe seeing the memory usage you
report in that, depending on the design of your app architecture, if you leave
the management of dll's to the O.S., then dll's are only loaded on an
as-required basis, and are only unloaded when the app shuts down. OSG has a
number of static memory constructs singletons that are created at dll load
time, and are not released until dll unload time (app shut down). One way
around this is to manage the dll load and unload yourself, however this can be
very tiresome ;-(
I would suggest that, unless you are witnessing a continual increase in the
memory allocated to your app, even when you are loading and unloading the same
model, then I wouldn't be too concerned. Obviously if you are witnessing
unrestricted memory consumption then something is up, but I suspect not at the
OSG end.
Finally, in my experience, beware of the false positive memory leaks reported
by Visual Studio. Plenty of back talk on this in the archives, but suffice it
to say VS unloads MFC too early in the app shut down process, which triggers a
dump of unreleased memory warnings. VS crystal ball not working too well as
when OSG dll's unload - usually after MFC due to VS problem with scheduling
library loads/unloads - it releases its own memory. Where real leaks actually
exist, more often than not it can be traced back to app coding errors, or
inappropriate use of non ref_ptr references to scenegraph entries. I've wasted
days in the past on this. You can decrease some of the false positives by
forcing the load of the OSG dll's yourself, but sometimes life is just too
short to be bothered !
Hope this helps.
Kind regards
Neil.
Alexandre Amalric alex.pix...@gmail.com wrote:
Hi osg-users,
I'm developping an application based on the example osgviewerMFC but I
don't understand the memory consumption from this example.
1) when I launch osgviewerMFC.exe the memory used is about 10Mo
2) then I open a model, memory rise to let's say 50Mo (depends on the model)
3) then I close the window and memory do not get back to 10Mo like desired
but stay at let say 30Mo (in my case).
Why osgviewerMFC.exe use much memory after opening and closing a model than
before doing nothing ??
I am asking this because I have the same behaviour with my own application,
I suppose something isn't well destroyed when closing a window (removing a
viewer).
Kind regards,
--
Alexandre AMALRIC Ingénieur RD
===
PIXXIM S.A. 73E, rue Perrin-Solliers 13006 Marseille
http://www.pixxim.fr
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org