directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <>
Subject [Directory Wiki] Update of "Asn1Home" by EmmanuelLecharny
Date Wed, 30 Mar 2005 22:29:13 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Directory Wiki" for change notification.

The following page has been changed by EmmanuelLecharny:

  Another problem is the String allocations. Strings are immutable, so they can't be reused.
It's not possible to create a String pool, so memory is not manageable with Strings. We have
two ways here :
   - create a new MutableString class, which is quite a piece of work, because we need to
handle UTF-8
   - pre-allocate as much as String than we can, up to the StringPool limit, and each time
we need to create a new String, we will just have to nullify the pre-allocated one. As String
could have different sizes, we have to pre-allocate Strings with different sizes, like 16-chars
length Strings, 32-chars Strings, and so on. If we have to allocate, say, a 44 char long String,
we will free a 48-chars String, so the memory will nevcer be exhausted. If there is no more
48-chars String available, then we could free either a 64-chars String (or a bigger one),
or free one 32-chars String and a 16-chars String. Strings above 1024 bytes will be streamed.
  This may seems very complicated, but we have to deal with this kind of constraints, as the
PDU that we can receive may be really strange, or built to break the server. 
View raw message