CGTalk > Software > Autodesk 3ds max > 3dsMax SDK and MaxScript
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 11-26-2010, 09:33 AM   #1
Mr-Bullfrog
Veteran
portfolio
Jeremy Massey
Technical Artist
Singapore
 
Join Date: Oct 2004
Posts: 47
Clearing unused textures from memory?

Howdy all!

I'm writing a tool for creating billboarded trees, and am running into an issue with memory usage when generating the materials.

I'm generating a new material every time the user confirms a property change, and assigning it to the selected objects of supported type. I'm noticing the memory usage goes up each time. This makes sense, since it's loading the textures each time. I've been trying to find a way to clear / remove a texture from memory but haven't had any luck.

I found freeSceneBitmaps() which sounded like what I wanted, but doesn't appear to help. Any suggestions?

Thanks!
 
Old 11-26-2010, 12:19 PM   #2
PEN
R&D/Technical Director
 
PEN's Avatar
portfolio
Paul Neale
PEN Productions
Canada
 
Join Date: Jun 2002
Posts: 7,415
Did you try a GC() after the freeSceneBitmaps?
__________________
Paul Neale
http://paulneale.com
 
Old 11-26-2010, 01:09 PM   #3
Mr-Bullfrog
Veteran
portfolio
Jeremy Massey
Technical Artist
Singapore
 
Join Date: Oct 2004
Posts: 47
Quote:
Originally Posted by PEN
Did you try a GC() after the freeSceneBitmaps?

Thanks Paul! That's the ticket!

I never knew there was a way to manually invoke garbage collection, sure to be very handy in other areas!

Thanks again!
 
Old 11-26-2010, 11:20 PM   #4
lucpet
Know-it-All
 
lucpet's Avatar
portfolio
Luke Pettit
Canberra, Australia
 
Join Date: Oct 2006
Posts: 378
This will save you some time

I hope this helps, I had need of it a while ago.


Code:
Rollout freeMem "FreeMem" ( button gColl "Garbage Collection" toolTip:"Press this button to Free up Memory." button fScen "Free Scene Bitmaps" toolTip:"Press this button to Free up scene bitmaps." button cUndo "Clear Undo Buffer" toolTip:"Press this button to clear the undo buffer." button doAll "Run all three at once" toolTip:"Press this button to run all of the above three buttons." on gColl pressed do (gc()) on fScen pressed do (freeSceneBitmaps()) on cUndo pressed do (clearUndoBuffer()) on doAll pressed do ( gc() freeSceneBitmaps() clearUndoBuffer() ) ) if freeMem != undefined do destroyDialog freeMem createdialog freeMem addRollout freeMem
__________________
Luke
Web site

3d Max 2012 Win 7
Intel Corei5 8g Ram


Last edited by lucpet : 11-26-2010 at 11:23 PM.
 
Old 11-27-2010, 03:24 AM   #5
Mr-Bullfrog
Veteran
portfolio
Jeremy Massey
Technical Artist
Singapore
 
Join Date: Oct 2004
Posts: 47
Quote:
Originally Posted by lucpet
I hope this helps, I had need of it a while ago.

Thanks Luke, that's a handy little script, will keep it for reference in future. Cheers!
 
Old 11-27-2010, 03:24 AM   #6
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,481
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 09:18 PM.


Powered by vBulletin
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.