stringStream allocates on both ResourceArea and C-heap

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Won't Fix
    • Priority: P4
    • tbd
    • Affects Version/s: 15
    • Component/s: hotspot
    • None

      stringStream implements ResourceObj and thus new() places it on the ResourceArea. The char* containing the printed content is allocated on the C heap.

      It is not desireable to allocate the char* on the ResourceArea as if it is resized under a deeper ResourceMark than that of the stringStream, the char* will be invalidated when leaving that deeper ResourceMark's scope. This led to various errors before.

      On the other side the fact that the destructor of stringStream must be called after allocating it with new() to free the char*, but delete() is not necessary/possible, is unexpected.

       

            Assignee:
            Unassigned
            Reporter:
            Goetz Lindenmaier
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: