View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0003084 | FSSCP | scripting | public | 2014-08-05 10:48 | 2014-08-05 17:15 |
Reporter | ngld | Assigned To | |||
Priority | normal | Severity | major | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 3.7.2 RC3 | ||||
Summary | 0003084: Bitmaps loaded with gr.loadTexture() are never released. | ||||
Description | gr.loadTexture() returns a texture handle. The handle has an unload method which calls bm_unload() but not bm_release(). Since the unload method invalidates the Lua handle it should be calling bm_release() instead. | ||||
Steps To Reproduce | Load a bunch of ANIs or bitmaps with gr.loadTexture() and use the unload() method to unload them. Type bm_frag in the debug console and note that the bitmaps weren't released. | ||||
Additional Information | To fix this bug the two calls to bm_unload() in code/parse/lua.cpp have to be replaced with bm_release() calls. The calls are on line 3352 and 3423 as of revision 10968. | ||||
Tags | No tags attached. | ||||
|
Just to drop a supplementary note - I applied these changes to resolve a memory usage problem that occurred when a number of images were loaded sequentially with gr.loadTexture(), where after a certain point my handles spontaneously started coming up as invalid / nil. Applying some aggressive unload() calls between each invocation didn't seem to resolve the issue. This was a critical blocker for a mod / campaign I'm working on. After replacing bm_unload() with bm_release() in lua.cpp as suggested here and recompiling, the problem seemed to be resolved. Full details in this thread: http://www.hard-light.net/forums/index.php?topic=87993.msg1758523#msg1758523 |
|
lua.cpp-unloadfix.patch (650 bytes)
Index: code/parse/lua.cpp =================================================================== --- code/parse/lua.cpp (revision 10927) +++ code/parse/lua.cpp (working copy) @@ -3349,7 +3349,7 @@ // use, and in order to prevent that we want to double-check the load count // here before unloading the bitmap. -zookeeper if(idx > -1 && bm_is_valid(idx) && bm_bitmaps[bm_get_cache_slot(idx, 0)].load_count < 1) - bm_unload(idx); + bm_release(idx); return ADE_RETURN_NIL; } @@ -3419,7 +3419,7 @@ if(!bm_is_valid(*idx)) return ADE_RETURN_NIL; - bm_unload(*idx); + bm_release(*idx); //WMC - invalidate this handle *idx = -1; |
|
.patch uploaded of changes as requested. |
|
Fix committed to trunk@10970. |
Date Modified | Username | Field | Change |
---|---|---|---|
2014-08-05 10:48 | ngld | New Issue | |
2014-08-05 16:17 | Parias | Note Added: 0016171 | |
2014-08-05 16:24 | Parias | File Added: lua.cpp-unloadfix.patch | |
2014-08-05 16:24 | Parias | Note Added: 0016172 | |
2014-08-05 17:15 | m_m | Changeset attached | => fs2open trunk r10970 |
2014-08-05 17:15 | m_m | Note Added: 0016174 | |
2014-08-05 17:15 | m_m | Status | new => resolved |
2014-08-05 17:15 | m_m | Resolution | open => fixed |