java - is String(byte[], charset) memory efficient -
i looking @ source code volley
, java networking library android, , puts entire network response new string object using constructor new string(byte[], string)
where bulk of network response byte[]
, headers parsed string.
is creating large string way memory efficient? i've seen network calls inputstream
s converted string
s in while loop , can crash application when application runs out of memory.
you don't efficient compared what, question doesn't have answer, overall agree you. response body after headers should made available input stream. infinitely long after all. reading entire requests or responses (or files) memory poor practice, , not 'efficient' several measures, example memory usage , latency.
Comments
Post a Comment