Skip to content
Snippets Groups Projects
  1. Sep 25, 2020
  2. May 02, 2017
    • Nat Goodspeed's avatar
      DRTVWR-418, MAINT-6996: Rationalize LLMemory wrt 64-bit support. · 52899ed6
      Nat Goodspeed authored
      There were two distinct LLMemory methods getCurrentRSS() and
      getWorkingSetSize(). It was pointless to have both: on Windows they were
      completely redundant; on other platforms getWorkingSetSize() always returned
      0. (Amusingly, though the Windows implementations both made exactly the same
      GetProcessMemoryInfo() call and used exactly the same logic, the code was
      different in the two -- as though the second was implemented without awareness
      of the first, even though they were adjacent in the source file.)
      
      One of the actual MAINT-6996 problems was due to the fact that
      getWorkingSetSize() returned U32, where getCurrentRSS() returns U64. In other
      words, getWorkingSetSize() was both useless *and* wrong. Remove it, and change
      its one call to getCurrentRSS() instead.
      
      The other culprit was that in several places, the 64-bit WorkingSetSize
      returned by the Windows GetProcessMemoryInfo() call (and by getCurrentRSS())
      was explicitly cast to a 32-bit data type. That works only when explicitly or
      implicitly (using LLUnits type conversion) scaling the value to kilobytes or
      megabytes. When the size in bytes is desired, use 64-bit types instead.
      
      In addition to the symptoms, LLMemory was overdue for a bit of cleanup.
      
      There was a 16K block of memory called reserveMem, the comment on which read:
      "reserve 16K for out of memory error handling." Yet *nothing* was ever done
      with that block! If it were going to be useful, one would think someone would
      at some point explicitly free the block. In fact there was a method
      freeReserve(), apparently for just that purpose -- which was never called. As
      things stood, reserveMem served only to *prevent* the viewer from ever using
      that chunk of memory. Remove reserveMem and the unused freeReserve().
      
      The only function of initClass() and cleanupClass() was to allocate and free
      reserveMem. Remove initClass(), cleanupClass() and the LLCommon calls to them.
      
      In a similar vein, there was an LLMemoryInfo::getPhysicalMemoryClamped()
      method that returned U32Bytes. Its job was simply to return a size in bytes
      that could fit into a U32 data type, returning U32_MAX if the 64-bit value
      exceeded 4GB. Eliminate that; change all its calls to getPhysicalMemoryKB()
      (which getPhysicalMemoryClamped() used internally anyway). We no longer care
      about any platform that cannot handle 64-bit data types.
      52899ed6
  3. Nov 10, 2015
  4. May 20, 2015
  5. Jul 01, 2013
  6. Apr 17, 2013
  7. Mar 29, 2013
  8. Sep 28, 2012
  9. Sep 26, 2012
  10. Sep 24, 2012
  11. Oct 14, 2011
  12. Feb 05, 2011
    • Aleric Inglewood's avatar
      Introduces a LLThreadLocalData class that can be · ef490e30
      Aleric Inglewood authored
      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).
      
      ***
      
      Addressed Boroondas remarks in https://codereview.secondlife.com/r/99/
      regarding (doxygen) comments. This patch effectively only changes comments.
      
      Includes some 'merge' stuff that ended up in llvocache.cpp
      (while starting as a bug fix, now only resulting in a cleanup).
      
      ***
      
      Added comment 'The use of apr_pool_t is OK here'.
      
      Added this comment on every line where apr_pool_t
      is correctly being used.
      
      This should make it easier to spot (future) errors
      where someone started to use apr_pool_t; you can
      just grep all sources for 'apr_pool_t' and immediately
      see where it's being used while LLAPRPool should
      have been used.
      
      Note that merging this patch is very easy:
      If there are no other uses of apr_pool_t in the code
      (one grep) and it compiles, then it will work.
      
      ***
      
      Second Merge (needed to remove 'delete mCreationMutex'
      from LLImageDecodeThread::~LLImageDecodeThread).
      
      ***
      
      Added back #include <apr_pools.h>.
      
      Apparently that is needed on libapr version 1.2.8.,
      the version used by Linden Lab, for calls to
      apr_queue_*. This is a bug in libapr (we also
      include <apr_queue.h>, that is fixed in (at least) 1.3.7.
      
      Note that 1.2.8 is VERY old. Even 1.3.x is old.
      
      ***
      
      License fixes (GPL -> LGPL). And typo in comments.
      Addresses merov's comments on the review board.
      
      ***
      
      Added Merov's compile fixes for windows.
      ef490e30
  13. Oct 13, 2010
  14. Sep 21, 2010
  15. Aug 13, 2010
  16. Jun 21, 2009
  17. May 08, 2009
  18. Jan 07, 2009
  19. Sep 05, 2008
  20. Oct 04, 2007
  21. Mar 02, 2007
  22. Jan 02, 2007
Loading