[prev in list] [next in list] [prev in thread] [next in thread]
List: haiku-bugs
Subject: [haiku-bugs] Re: [Haiku] #11934: [PATCH] Solve memory leaks in Deskbar and some replicants.
From: "pulkomandy" <trac () haiku-os ! org>
Date: 2015-03-31 11:53:21
Message-ID: 058.d41002ac256e5151e4600bd444c25b53 () haiku-os ! org
[Download RAW message or body]
#11934: [PATCH] Solve memory leaks in Deskbar and some replicants.
------------------------------+----------------------------
Reporter: Barrett | Owner: stippi
Type: enhancement | Status: new
Priority: normal | Milestone: R1
Component: User Interface | Version: R1/Development
Resolution: | Keywords: Deskbar
Blocked By: | Blocking:
Has a Patch: 1 | Platform: All
------------------------------+----------------------------
Comment (by pulkomandy):
Instead of using VLA arrays, you can use BStackOrHeapArray. The problem
with VLAs is that you can get a stack overflow if the data is big enough,
as they are allocated on the stack. BStackOrHeapArray will only allocate
small enough data on the stack (you set the threshold as a template
parameter), and will allocate extra memory if needed. It takes care of
freeing it when it goes out of scope.
Alternatively, a BAutoDeleter could be used (but in that case the data
will never be on the stack).
--
Ticket URL: <https://dev.haiku-os.org/ticket/11934#comment:8>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic