[opensource-dev] Review Request: STORM-864: As as developer, I would like an object oriented wrapper to make safe use of memory pools easier

Aleric Inglewood Aleric.Inglewood at gmail.com
Mon Jan 17 19:03:48 PST 2011


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://codereview.secondlife.com/r/99/
-----------------------------------------------------------

Review request for Viewer.


Summary
-------

Please see http://jira.secondlife.com/browse/STORM-864

I made a mercurial repository available for testing here:

hg clone https://bitbucket.org/aleric/viewer-development-storm-864

>From the commit message:

Introduces a LLThreadLocalData class that can be
accessed through the static LLThread::tldata().
Currently this object contains two (public) thread-local
objects: a LLAPRRootPool and a LLVolatileAPRPool.

The first is the general memory pool used by this thread
(and this thread alone), while the second is intended
for short lived memory allocations (needed for APR).
The advantages of not mixing those two is that the latter
is used most frequently, and as a result of it's nature
can be destroyed and reconstructed on a "regular" basis.

This patch adds LLAPRPool (completely replacing the old one),
which is a wrapper around apr_pool_t* and has complete
thread-safity checking.

Whenever an apr call requires memory for some resource,
a memory pool in the form of an LLAPRPool object can
be created with the same life-time as this resource;
assuring clean up of the memory no sooner, but also
not much later than the life-time of the resource
that needs the memory.

Many, many function calls and constructors had the
pool parameter simply removed (it is no longer the
concern of the developer, if you don't write code
that actually does an libapr call then you are no
longer bothered with memory pools at all).

However, I kept the notion of short-lived and
long-lived allocations alive (see my remark in
the jira here: https://jira.secondlife.com/browse/STORM-864?focusedCommentId=235356&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-235356
which requires that the LLAPRFile API needs
to allow the user to specify how long they
think a file will stay open. By choosing
'short_lived' as default for the constructor
that immediately opens a file, the number of
instances where this needs to be specified is
drastically reduced however (obviously, any
automatic LLAPRFile is short lived).


This addresses bug STORM-864.
    http://jira.secondlife.com/browse/STORM-864


Diffs
-----

  doc/contributions.txt 422f636c3343 
  indra/llaudio/llaudioengine_fmod.cpp 422f636c3343 
  indra/llaudio/llvorbisencode.cpp 422f636c3343 
  indra/llcharacter/llbvhloader.cpp 422f636c3343 
  indra/llcharacter/llkeyframemotionparam.cpp 422f636c3343 
  indra/llcharacter/llstatemachine.cpp 422f636c3343 
  indra/llcommon/CMakeLists.txt 422f636c3343 
  indra/llcommon/llapp.cpp 422f636c3343 
  indra/llcommon/llapr.h 422f636c3343 
  indra/llcommon/llapr.cpp 422f636c3343 
  indra/llcommon/llaprpool.h PRE-CREATION 
  indra/llcommon/llaprpool.cpp PRE-CREATION 
  indra/llcommon/llcommon.h 422f636c3343 
  indra/llcommon/llcommon.cpp 422f636c3343 
  indra/llcommon/llerror.h 422f636c3343 
  indra/llcommon/llerror.cpp 422f636c3343 
  indra/llcommon/llfixedbuffer.cpp 422f636c3343 
  indra/llcommon/llscopedvolatileaprpool.h PRE-CREATION 
  indra/llcommon/llthread.h 422f636c3343 
  indra/llcommon/llthread.cpp 422f636c3343 
  indra/llcommon/llthreadsafequeue.h 422f636c3343 
  indra/llcommon/llthreadsafequeue.cpp 422f636c3343 
  indra/llcommon/llworkerthread.h 422f636c3343 
  indra/llcommon/llworkerthread.cpp 422f636c3343 
  indra/llcrashlogger/llcrashlogger.cpp 422f636c3343 
  indra/llimage/llimage.cpp 422f636c3343 
  indra/llimage/llimagedimensionsinfo.cpp 422f636c3343 
  indra/llimage/llimagej2c.cpp 422f636c3343 
  indra/llimage/llimageworker.h 422f636c3343 
  indra/llimage/llimageworker.cpp 422f636c3343 
  indra/llmath/llvolumemgr.cpp 422f636c3343 
  indra/llmessage/llares.cpp 422f636c3343 
  indra/llmessage/llcurl.cpp 422f636c3343 
  indra/llmessage/lliohttpserver.h 422f636c3343 
  indra/llmessage/lliohttpserver.cpp 422f636c3343 
  indra/llmessage/lliosocket.h 422f636c3343 
  indra/llmessage/lliosocket.cpp 422f636c3343 
  indra/llmessage/llmail.h 422f636c3343 
  indra/llmessage/llmail.cpp 422f636c3343 
  indra/llmessage/llpumpio.h 422f636c3343 
  indra/llmessage/llpumpio.cpp 422f636c3343 
  indra/llmessage/llurlrequest.cpp 422f636c3343 
  indra/llmessage/message.cpp 422f636c3343 
  indra/llmessage/tests/networkio.h 422f636c3343 
  indra/llplugin/llplugininstance.h 422f636c3343 
  indra/llplugin/llplugininstance.cpp 422f636c3343 
  indra/llplugin/llpluginmessagepipe.cpp 422f636c3343 
  indra/llplugin/llpluginprocesschild.cpp 422f636c3343 
  indra/llplugin/llpluginprocessparent.h 422f636c3343 
  indra/llplugin/llpluginprocessparent.cpp 422f636c3343 
  indra/llplugin/llpluginsharedmemory.h 422f636c3343 
  indra/llplugin/llpluginsharedmemory.cpp 422f636c3343 
  indra/llplugin/slplugin/slplugin.cpp 422f636c3343 
  indra/llvfs/lllfsthread.cpp 422f636c3343 
  indra/llvfs/llvfs.cpp 422f636c3343 
  indra/media_plugins/gstreamer010/llmediaimplgstreamer.h 422f636c3343 
  indra/media_plugins/gstreamer010/llmediaimplgstreamer_syms.cpp 422f636c3343 
  indra/media_plugins/webkit/linux_volume_catcher.cpp 422f636c3343 
  indra/newview/llappviewer.h 422f636c3343 
  indra/newview/llappviewer.cpp 422f636c3343 
  indra/newview/llappviewerlinux.cpp 422f636c3343 
  indra/newview/llappviewerlinux_api_dbus.cpp 422f636c3343 
  indra/newview/llappviewermacosx.cpp 422f636c3343 
  indra/newview/llfloateranimpreview.cpp 422f636c3343 
  indra/newview/llmainlooprepeater.cpp 422f636c3343 
  indra/newview/lltexturecache.h 422f636c3343 
  indra/newview/lltexturecache.cpp 422f636c3343 
  indra/newview/lltexturefetch.cpp 422f636c3343 
  indra/newview/llviewermenufile.cpp 422f636c3343 
  indra/newview/llvoavatar.cpp 422f636c3343 
  indra/newview/llvocache.h 422f636c3343 
  indra/newview/llvocache.cpp 422f636c3343 
  indra/newview/llvoicevivox.cpp 422f636c3343 
  indra/newview/llwatchdog.cpp 422f636c3343 
  indra/newview/tests/llworldmap_test.cpp 422f636c3343 
  indra/test/lltemplatemessagebuilder_tut.cpp 422f636c3343 
  indra/test/message_tut.cpp 422f636c3343 
  indra/test/test.cpp 422f636c3343 
  indra/test_apps/llplugintest/llmediaplugintest.cpp 422f636c3343 
  indra/viewer_components/updater/llupdateinstaller.cpp 422f636c3343 

Diff: http://codereview.secondlife.com/r/99/diff


Testing
-------

Compiles and viewer functions normally.

The new classes (LLAPRPool, LLThreadLocalData) and the LLAPRFile changes have been tested a lot more extensive, since they have been used as-is for months in imprudence and before that in my own viewer (since April). However, the patch contains changes to code elsewhere (to adapt it to the new API) that is rather new in this source tree. Note that changes with regard to LLAPRFile already have been in Snowglobe since version 1.1 (with some minor changes) including the method used to make thread-local data available.


Thanks,

Aleric

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.secondlife.com/pipermail/opensource-dev/attachments/20110118/7467bc1a/attachment-0001.htm 


More information about the opensource-dev mailing list