Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"

Liste des GroupesRevenir à l c 
Sujet : Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"
De : bc (at) *nospam* freeuk.com (bart)
Groupes : comp.lang.c++ comp.lang.c
Date : 08. Mar 2024, 17:15:36
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <usfa2o$1orr3$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
User-Agent : Mozilla Thunderbird
On 08/03/2024 14:07, David Brown wrote:
On 08/03/2024 13:41, Paavo Helde wrote:
07.03.2024 17:36 David Brown kirjutas:
>
CPython does use garbage collection, as far as I know.
>
>
AFAIK CPython uses reference counting, i.e. basically the same as C++ std::shared_ptr (except that it does not need to be thread-safe).
 Yes, that is my understanding too.  (I could be wrong here, so don't rely on anything I write!)  But the way it is used is still a type of garbage collection.  When an object no longer has any "live" references, it is put in a list, and on the next GC it will get cleared up (and call the asynchronous destructor, __del__, for the object).
Is that how CPython works? I can't quite see the point of saving up all the deallocations so that they are all done as a batch. It's extra overhead, and will cause those latency spikes that was the problem here.
In my own reference count scheme, when the count reaches zero, the memory is freed immediately.
I also tend to have most allocations being of either 16 or 32 bytes, so reuse is easy. It is only individual data items (a long string or long array) that might have an arbitrary length that needs to be in contiguous memory.
Most strings however have an average length of well below 16 characters in my programs, so use a 16-byte allocation.
I don't know the allocation pattern in that Discard app, but Michael S suggested they might not be lots of arbitrary-size objects.

Date Sujet#  Auteur
7 Mar 24 * Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"23David Brown
7 Mar 24 +* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"15Michael S
7 Mar 24 i`* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"14David Brown
7 Mar 24 i +- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"1Kaz Kylheku
8 Mar 24 i `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"12Paavo Helde
8 Mar 24 i  +* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"3David Brown
8 Mar 24 i  i`* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"2bart
8 Mar 24 i  i `- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"1David Brown
29 Apr 24 i  `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"8Lawrence D'Oliveiro
29 Apr 24 i   +* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"5Chris M. Thomasson
29 Apr 24 i   i`* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"4Kaz Kylheku
29 Apr 24 i   i `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"3Chris M. Thomasson
29 Apr 24 i   i  `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"2Kaz Kylheku
29 Apr 24 i   i   `- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"1Chris M. Thomasson
29 Apr 24 i   `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"2paavo512
29 Apr 24 i    `- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"1Chris M. Thomasson
7 Mar 24 `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"7Kaz Kylheku
8 Mar 24  `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"6David Brown
8 Mar 24   `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"5Michael S
8 Mar 24    `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"4David Brown
8 Mar 24     +- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"1Michael S
29 Apr 24     `* Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"2Lawrence D'Oliveiro
29 Apr 24      `- Re: "White House to Developers: Using C or C++ Invites Cybersecurity Risks"1aph

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal