title: Retrofit with RX runs OutOfMemory while trying to send a large BASE64
body: <p>I want to send a model throw Retrofit, which contains some standard fields and files, encoded in BASE64 format. I know, that this is a crazy way to send files, but I have a server with no backend developer. </p>
  
  <p>So, when I'm sending, for example, 3 pdf files 20mb each, I runs out of memory which exception like this</p>
  
  <blockquote>
    <p>Failed to allocate a 30544558 byte allocation with 2085152 free bytes and 26MB until OOM</p>
  </blockquote>
  
  <p>I figured out, that it's a problem in parse of base64 string, which I'm already have in memory to Json throw GSON. I tried to create to create a custom adapter, according to <a href="https://stackoverflow.com/questions/57981532/retrofit-outofmemory-exception-while-loading-a-files-in-base64-to-server">Retrofit OutOfMemory exception while loading a files in BASE64 to server</a> but runs out of ideas in case of a large model. What will fix this problem with passing of a large string to a JSON? Maybe I can use other adapters, not a GSON?</p>
  
  <p>Model of documents field in Json and whole model</p>
  
  <pre><code>data class Document(
      var base64: MutableList&lt;String?&gt;,
      var mime: String?,
      var name: String?
  )
  
  data class OrderMainModel(
      var INN: String?,
      var KPP: String?,
      var addressOfEstateObject: String?,
      var addressOfGardenObject: String?,
      var agentFathersName: String?,
      var agentFirstName: String?,
      var agentLastName: String?,
      var approximateSizeOfEstateObject: Double?,
      var approximateSizeOfOKS: Double?,
      var area: String?,
      var bankAccountNumber: Int?,
      var companyAddress: String?,
      var companyName: String?,
      var documents: List&lt;Document?&gt;
  }
  </code></pre>
  
  <p>Retrofit method</p>
  
  <pre><code>@Streaming
  @POST("/api/order/")
  fun makeOrder(@Header("Authorization") token: String, @Body order: OrderMainModel): Single&lt;Response&lt;PhoneNumberResponse&gt;&gt;
  </code></pre>