Re: How to allocate memory for a linked list of pointers in a kernel process



In addition to Tim's questions: are you sure you access memory at proper
IRQL? You can use paged pool only at passive level.

--
V
This posting is provided "AS IS" with no warranties, and confers no
rights.
"Tim Roberts" <timr@xxxxxxxxx> wrote in message
news:v9h2r3dsbf74mqiduami1euutagu280717@xxxxxxxxxx
joemango <joseandremorales@xxxxxxxxx> wrote:

Hi everyone, i am building a short program that builds several linked
lists using pointers of course. Its my first time doing this in the
kernel, i need to know the best way to allocate memory when i create a
new pointer that will for multiple pointers to be created without
causing a system crash, I had started with pointer delclaration
getting memory allocation with the ExAllocatePoolXxx function. but
quickly found that would not work i was declaring too many pointers
and used up all of the small amount of pool memory causing a BSOD !

For gosh sakes, how many pointers are you allocating? If you run with
Driver Verifier, ExAllocatePool ends up allocating a page per allocation,
which could eat up space, but otherwise I'm confused.

so now i need to know what i can use to access memory for my linked
lists that wont cause teh BSOD and the right way to do to be efficient
with memory usage.

Linked lists of what? Usually, the linked list pointers will be part of
another, larger structure. When the kernel routines need to allocate a
bunch of items of the same size, they use a lookaside list
(ExInitializePagedLookasideList, ExAllocateFromPagedLookasideList, etc).

Are you aware that the kernel contains routines to do doubly linked lists
(InitializeListHead, InsertTailList, InsertHeadList, etc)?
--
Tim Roberts, timr@xxxxxxxxx
Providenza & Boekelheide, Inc.


.



Relevant Pages

  • Re: Ranting about JVMs default memory limits...
    ... Originally, 32-bit Windows split it half and half, with the user code getting 2GB and the OS getting 2GB. ... But, the OS didn't really need 2GB of address space, and so enabling "LARGEADDRESSAWARE" tells the OS that the application doesn't make any assumptions about the range of pointers and that it can pass user data addresses to the process in the first 1GB of the second 2GB of the full 4GB address space. ... Memory blocks aren't moveable, so allocations can sit in between two free blocks, limiting the size of the largest block that can actually be allocated. ... Depending on the allocation pattern, it's not hard at all to have over 1GB of virtual address space left, but not be able to allocate any single block nearly that large. ...
    (comp.lang.java.programmer)
  • Re: Help wanted - problems with heap
    ... Memory pressure, because of limited heap size. ... identified that by failures to allocate memory. ... Any pointers as to work out what is happening would be welcome. ...
    (rec.games.roguelike.development)
  • Re: Singly Linked List in C
    ... <stuff about the xored pointer trick to get pseudo-doubly linked lists ... You can achieve a greater increase in memory ... XOR technique can be applied - in ANSI C - without relying on ... Pointers generally have a range much larger than is necessary to index ...
    (comp.programming)
  • Re: A modern way to solve the "callback problem" from a subroutine?
    ... Many Fortran "tricks" are based on how to use that memory within ... pointers allow more efficient memory usage. ... if linked lists are so overwhelmingly beneficial, ... that the system supplies a pointer to the data in the input buffer ...
    (comp.lang.fortran)
  • Re: pointer, equivalence, common block, 32bit code, ifort v11 64bit, segfault
    ... If it's relevant this is how memory is allocated: ... Compiles fine with ifort v11.83 ia32 on ... In a pointer .h file, pointers, their targets and equivalence ... After other routines allocate memory for a pointer, ...
    (comp.lang.fortran)