Skip to content

Commit

Permalink
Debug Windows memory usage in pp_study
Browse files Browse the repository at this point in the history
  • Loading branch information
khwilliamson committed May 6, 2023
1 parent b0264c6 commit 260fdaa
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pp.c
Expand Up @@ -651,6 +651,18 @@ PP(pp_study)
{
dSP; dTOPss;
STRLEN len;
#ifdef PERL_IMPLICIT_CONTEXT
# ifdef WIN32
# include "Sysinfoapi.h"
MEMORYSTATUSEX statex;
statex.dwLength = sizeof (statex);
GlobalMemoryStatusEx (&statex);

DEBUG_U(PerlIO_printf(Perl_debug_log, "%s:%d:%p: %llu\n", __FILE__, __LINE__, aTHX_ statex.ullAvailVirtual));
# else
/*DEBUG_U(PerlIO_printf(Perl_debug_log, "%s:%d:%p: %p\n", __FILE__, __LINE__, aTHX_ sbrk((intptr_t) 0)));*/
# endif
#endif

(void)SvPV(sv, len);
if (len == 0 || len > I32_MAX || !SvPOK(sv) || SvUTF8(sv) || SvVALID(sv)) {
Expand Down

0 comments on commit 260fdaa

Please sign in to comment.