How do I delete a resource?
3 posters
How do I delete a resource?
e.g.
When entering the game.
Game process
As follows :
1 Logo Maps.
2 Menus.
3 GameStart.
When I entering the GameStart. I will delete Logo maps.
use sio2ResourceDel()? use sio2ImageFree()? use sio2WidgetFree()? I have tried each.However, no effect.
Memory space is unchanged.
How to do?
When entering the game.
Game process
As follows :
1 Logo Maps.
2 Menus.
3 GameStart.
When I entering the GameStart. I will delete Logo maps.
use sio2ResourceDel()? use sio2ImageFree()? use sio2WidgetFree()? I have tried each.However, no effect.
Memory space is unchanged.
How to do?
LuisLee- Posts : 85
Join date : 2009-04-26
Age : 37
Re: How do I delete a resource?
This is how I free the resource of my game:
sio2ResourceUnload( udgame->_SIO2resource, SIO2_SOUND );
sio2ResourceUnloadAll( udgame->_SIO2resource );
udgame->_SIO2resource = sio2ResourceFree( udgame->_SIO2resource );
Notice that I remove all sound first since I have some sound created manually, it is necessary in order to avoid an OpenAL warning... However if the sound comes directly from a .sio2 this will not happen...
sio2ResourceUnload( udgame->_SIO2resource, SIO2_SOUND );
sio2ResourceUnloadAll( udgame->_SIO2resource );
udgame->_SIO2resource = sio2ResourceFree( udgame->_SIO2resource );
Notice that I remove all sound first since I have some sound created manually, it is necessary in order to avoid an OpenAL warning... However if the sound comes directly from a .sio2 this will not happen...
Re: How do I delete a resource?
sio2interactive wrote:This is how I free the resource of my game:
sio2ResourceUnload( udgame->_SIO2resource, SIO2_SOUND );
sio2ResourceUnloadAll( udgame->_SIO2resource );
udgame->_SIO2resource = sio2ResourceFree( udgame->_SIO2resource );
Notice that I remove all sound first since I have some sound created manually, it is necessary in order to avoid an OpenAL warning... However if the sound comes directly from a .sio2 this will not happen...
Your way is to delete all of the resources, is it? I
but,I would like to delete the specified picture.
e.g.
I have a few logo picture.Names are "a.png","b.png" and so on. I will delete "a.png".How to do?
Before, my method is:
itMapWidget=m_pMapWidget.find("a.png");
sio2WidgetFree(itMapWidget->second);
Is wrong.
LuisLee- Posts : 85
Join date : 2009-04-26
Age : 37
Re: How do I delete a resource?
_SIO2resource = YOURRESOURCE THAT CONTAIN THE A.PNG ...
sio2->_SIO2resource = _SIO2resource
sio2ImageFree( sio2ResourceImageGet( _SIO2resource, "a.png" ) );
sio2ImageFree( sio2ResourceImageGet( _SIO2resource, "b.png" ) );
etc...
sio2->_SIO2resource = _SIO2resource
sio2ImageFree( sio2ResourceImageGet( _SIO2resource, "a.png" ) );
sio2ImageFree( sio2ResourceImageGet( _SIO2resource, "b.png" ) );
etc...
Re: How do I delete a resource?
sio2interactive wrote:_SIO2resource = YOURRESOURCE THAT CONTAIN THE A.PNG ...
sio2->_SIO2resource = _SIO2resource
sio2ImageFree( sio2ResourceImageGet( _SIO2resource, "a.png" ) );
sio2ImageFree( sio2ResourceImageGet( _SIO2resource, "b.png" ) );
etc...
thank you! but I use this method
itMapWidget=m_pMapWidget.find("a.png");
sio2ImageFree(itMapWidget->second->_SIO2material->_SIO2image[ SIO2_MATERIAL_CHANNEL0]);
Smaller memory space( -4M). but There is no satisfactory results.
My method is this. Save the container widget with map pointer.The release of pictures when resources such as the above.This is the same effect?
LuisLee- Posts : 85
Join date : 2009-04-26
Age : 37
Re: How do I delete a resource?
Please define what you mean by:
>> Smaller memory space( -4M)
and then think about it for 10 seconds
>> Smaller memory space( -4M)
and then think about it for 10 seconds
Re: How do I delete a resource?
If You now that object/image/whatever will be changed often, it's better to make global handlers for sio2resource "baskets" and simply unload and free them, and load into them something else after unload
_-MADMAN-_- Posts : 52
Join date : 2009-04-23
Re: How do I delete a resource?
Totally... Just keep the sio2resource for the generic stuff but keep the handle of the dynamic or called often stuff...
Re: How do I delete a resource?
Smaller memory space( -4M) Mean: 4mb of memory space reduction.
I did not make that clear. he~he~he
thank you for you help!!!!!
LuisLee- Posts : 85
Join date : 2009-04-26
Age : 37
Re: How do I delete a resource?
No Im asking why this:
itMapWidget=m_pMapWidget.find("a.png");
sio2ImageFree(itMapWidget->second->_SIO2material->_SIO2image[ SIO2_MATERIAL_CHANNEL0]);
Have a 4MB less of memory usage compare to the regular sio2ResourceGetImage function and SIO2resource storage... SIO2resource is really small by default (172 bytes) and take an extra 4 bytes for every handle... so Im telling you that you can load about 4 millions of handle before it reaches 4MB... If your .find method is the one of an std::vector, I can told you right there that the memory that you are consuming for the list is WAY bigger than the SIO2 method and the performance of the find function is no match compare to the sio2StringCmp search function...
This is why I was asking you to think at least 10 sec to backup your statement
itMapWidget=m_pMapWidget.find("a.png");
sio2ImageFree(itMapWidget->second->_SIO2material->_SIO2image[ SIO2_MATERIAL_CHANNEL0]);
Have a 4MB less of memory usage compare to the regular sio2ResourceGetImage function and SIO2resource storage... SIO2resource is really small by default (172 bytes) and take an extra 4 bytes for every handle... so Im telling you that you can load about 4 millions of handle before it reaches 4MB... If your .find method is the one of an std::vector, I can told you right there that the memory that you are consuming for the list is WAY bigger than the SIO2 method and the performance of the find function is no match compare to the sio2StringCmp search function...
This is why I was asking you to think at least 10 sec to backup your statement
Similar topics
» What is the Correct Way to Delete an SIO2Object?
» Resource Management
» About resource management in blender that work with SIO2
» resetting scenes, sio2 resource files, and multiple levels
» Resource Management
» About resource management in blender that work with SIO2
» resetting scenes, sio2 resource files, and multiple levels
Permissions in this forum:
You cannot reply to topics in this forum