Age | Commit message (Collapse) | Author | Files | Lines |
|
and can't properly handle leaks of doubly linked lists which we use a
lot (as the memory is always reachable). Even with --show-reachable
its hard to track leaks down sometimes.
I realised that talloc does have the necessary information to track
these, and by using the cascading property of the new talloc it can
report on leaks in a much more succinct fashion than valgrind can.
I have added a new samba option --leak-check that applies to all Samba
tools. When enabled it prints a leak report summarising all top level
contexts that are present when the program exits. A typical report
looks like this:
talloc report on 'null_context' (total 1071 bytes in 52 blocks)
iconv(CP850,UTF8) contains 43 bytes in 3 blocks
UNNAMED contains 24 bytes in 1 blocks
UNNAMED contains 24 bytes in 1 blocks
dcesrv_init contains 604 bytes in 26 blocks
server_service contains 120 bytes in 6 blocks
UNNAMED contains 24 bytes in 1 blocks
UNNAMED contains 24 bytes in 1 blocks
server_service contains 104 bytes in 4 blocks
server_context contains 12 bytes in 2 blocks
iconv(UTF8,UTF-16LE) contains 46 bytes in 3 blocks
iconv(UTF-16LE,UTF8) contains 46 bytes in 3 blocks
the numbers are recursive summaries for all the memory hanging off each context.
this option is not thread safe when used, but the code is thread safe
if the option is not given, so I don't think thats a problem.
(This used to be commit 96d33d36a5639e7fc46b14a470ccac674d87c62a)
|
|
Andrew Bartlett
(This used to be commit 1640272dc36a0cb5bc8e647d06c7cee46022f077)
|
|
(This used to be commit a3a15f9d1a3b51cb7099b5f3adb8401dfc37793d)
|
|
--enable-developer warning for when they are missing.
Andrew Bartlett
(This used to be commit 8115e44d47bcd65edba08d10117180ae508cdbc1)
|
|
this means you can do:
talloc_set_destructor(ptr, my_destructor);
and your destructor will be called with the pointer as an argument
when the pointer is about to be freed. The destructor can refuse the
free by returning -1.
You can also increase the reference count on a pointer like this:
talloc_increase_ref_count(ptr);
and a talloc_free() will just reduce the reference count, only
actually freeing the memory when the count reaches zero.
(This used to be commit b5608d52d33a1d8be5a8a6751bc6cec162c7ed92)
|
|
it can only indicate programmer error, and doing a smb_panic() ensures
an automatic backtrace (and eventually an abort()).
Andrew Bartlett
(This used to be commit b2d93d0010d80f158760f53273853de2439c3062)
|
|
(This used to be commit 6ffdfd779936ce8c5ca49c5f444e8da2bbeee0a8)
|
|
This version does the following:
1) talloc_free(), talloc_realloc() and talloc_steal() lose their
(redundent) first arguments
2) you can use _any_ talloc pointer as a talloc context to allocate
more memory. This allows you to create complex data structures
where the top level structure is the logical parent of the next
level down, and those are the parents of the level below
that. Then destroy either the lot with a single talloc_free() or
destroy any sub-part with a talloc_free() of that part
3) you can name any pointer. Use talloc_named() which is just like
talloc() but takes the printf style name argument as well as the
parent context and the size.
The whole thing ends up being a very simple piece of code, although
some of the pointer walking gets hairy.
So far, I'm just using the new talloc() like the old one. The next
step is to actually take advantage of the new interface
properly. Expect some new commits soon that simplify some common
coding styles in samba4 by using the new talloc().
(This used to be commit e35bb094c52e550b3105dd1638d8d90de71d854f)
|
|
(This used to be commit d721b122b5c443363b8f8ec2e1ef4b798378b658)
|
|
team meeting at CIFS04. It allows you to find the talloc context given
any pointer allocated with talloc.
(This used to be commit 01dc4ed9b4f9390930d3c235cf2ccf9a9028392d)
|
|
- NULL in, NULL out
Andrew Bartlett
(This used to be commit 2cc0b3a2f1785c53268f018999a87c26539fd4a6)
|
|
just a alloc_asprintf().
(makes it easier to use in a loop)
Andrew Bartlett
(This used to be commit 5816d09c47252d2ee8732722b3cc44ea865b8fcc)
|
|
(This used to be commit 363cb3377a0eca5bfef71a02dcdc21c5fadbaf32)
|
|
metze
(This used to be commit 57151e80eb1090281401930c8fe25b20a8cf3a38)
|
|
talloc_free() O(1) in preparation. This also halves the number of
malloc() calls and increases our internal consistency checking,
without breaking valgrind testing.
(This used to be commit 2331d4e76e40ff08215853f747f7063213ac92ce)
|
|
(This used to be commit 20458556017f426ab57ca9a9d098cacecefbdcff)
|
|
implements the epm_Lookup() call, I'll add the other important calls
soon. I was rather pleased to find that epm_Lookup() worked first
time, which is particularly surprising given its complexity.
This required quite a bit of new infrastructure:
* a generic way of handling dcerpc policy handles in the rpc server
* added type checked varients of talloc. These are much less error
prone. I'd like to move to using these for nearly all uses of
talloc.
* added more dcerpc fault handling code, and translation from
NTSTATUS to a dcerpc fault code
* added data_blob_talloc_zero() for allocating an initially zero
blob
* added a endpoint enumeration hook in the dcerpc endpoint server
operations
(This used to be commit 3f85f9b782dc17417baf1ca557fcae22f5b6a83a)
|
|
(This used to be commit b0510b5428b3461aeb9bbe3cc95f62fc73e2b97f)
|